Re: uso di PGFplots e MatLab combinato

#45292
Up
0
Down
::


Trovata la soluzione! Era più semplice di quanto pensassi! ecco l’esempio!
`\documentclass{article}
\usepackage{filecontents}

\begin{filecontents}{dati.dat}
a b c d e f g h i
0 3.4155 4.644 1.0695 1.0275 12.919 13.24 2.858 2.9545
1.42 3.409 4.2105 1.3565 1.195 12.422 13.387 2.5955 2.9875
2.84 3.479 4.596 1.32 1.1065 12.8945 13.498 2.674 2.7915
4.26 7.983 2.375 6.39 4.272 10.368 2.452 5.404 6.937
5.68 0.6015 2.0825 2.218 3.6255 2.623 3.7575 3.588 3.3695
7.1 0.4115 0.6635 1.931 2.2585 1.813 1.857 2.917 2.486
8.52 0.362 0.378 2.2515 2.193 1.726 1.947 3.2075 2.864
9.94 0.66 0.755 2.283 2.179 1.9455 1.734 2.8045 3.0135
11.36 0.5265 0.4595 2.1155 2.3535 1.8705 2.28 3.1175 3.044
12.78 0.48 0.785 2.209 2.148 1.9295 2.225 2.626 2.8665
14.2 0.242 0.5245 2.528 2.163 2.084 1.942 2.9865 3.111
15.62 0.3055 0.5345 2.5715 2.4265 1.772 2.2065 3.1615 3.1305
17.04 0.5905 0.491 2.3095 2.598 1.779 2.0145 3.22 2.978
18.46 0.7065 0.838 2.614 2.55 2.0725 2.273 3.311 3.0525
19.88 0.264 0.546 2.85 2.423 1.9485 2.25 3.576 3.1805
21.3 0.6125 0.5925 2.254 2.765 2.2555 2.268 3.493 3.28
22.72 0.7415 0.496 2.4645 2.4585 1.941 1.9985 3.66 3.146
24.14 0.8015 0.826 2.871 2.584 2.0885 1.9845 3.9915 3.494
25.56 0.756 0.6935 2.542 2.8065 2.0545 2.5015 3.6105 3.441
26.98 0.795 0.6785 2.686 2.5985 1.934 2.263 3.9825 3.5835
28.4 0.7015 0.744 2.9675 2.9125 2.249 2.436 3.907 3.5465
29.82 0.6835 0.739 2.721 2.8 2.215 2.1845 3.93 3.503
31.24 0.6135 0.7735 2.766 3.021 1.999 2.4425 4.103 3.7565
32.66 0.6565 0.602 2.664 3.2475 2.4185 3.004 4.051 3.9415
34.08 0.5875 0.4105 2.65 3.1305 2.573 2.5335 4.1905 3.496
35.5 0.672 0.619 2.8155 2.9625 1.8805 2.6275 4.282 3.3955
36.92 0.61 0.803 2.9695 3.01 2.3745 2.3795 4.346 4.0415
38.34 0.6625 0.6075 2.8155 3.034 2.4495 2.239 4.1875 4.255
39.76 0.861 0.6695 2.746 3.0385 2.373 2.6935 4.491 4.073
41.18 0.6365 0.6765 2.8065 3.3195 2.521 2.6885 4.3865 4.277
42.6 0.6615 1.0885 3.174 3.354 2.267 2.618 4.654 4.202
44.02 0.719 0.92 3.0335 2.8835 2.5035 2.652 4.6245 4.0305
45.44 1.008 1.2055 2.9865 3.2295 2.288 2.6995 4.839 4.0305
46.86 0.82 1.0055 3.347 3.26 2.632 2.6745 4.587 4.16
48.28 0.813 1.0065 3.282 3.261 2.581 2.9665 4.5485 4.6345
49.7 0.9085 0.7655 3.018 3.1945 2.8305 3.012 4.671 4.1045
51.12 0.8345 0.9945 3.2095 3.3925 2.6345 2.6135 4.8765 4.456
52.54 0.7935 0.802 3.466 3.146 2.5745 2.8505 5.097 4.486

\end{filecontents}

\usepackage{pgfplots}
\pgfplotsset{compat=1.7} % versione corrente: usare quella installata
% consultando la documentazione del pacchetto per reperirla

\begin{document}
\centering
\begin{tikzpicture}
\begin{axis}

\addplot[purple] table[
x = a,
y = e]{dati.dat};

\addplot[blue] table[
x = a,
y = b] {dati.dat};

\addplot[red] table[
x = a,
y = c] {dati.dat};

\addplot[green] table[
x = a,
y = d] {dati.dat};

\end{axis}
\end{tikzpicture}
\end{document}`

ah che felicità!

Go to top