Physique_et_informatique/ModeleLaTeX_TP-gnuplottex-f...

59 lines
2.5 KiB
Gnuplot
Executable File

set terminal epslatex font 8 color dashed
set output './ModeleLaTeX_TP-gnuplottex-fig1.tex'
set format '\num{%g}'
set key top right Left
set key width 1
set key heigh 1
set key spacing 1.5
#set sample 1000
#set xr [0:11]
#set yr [0:11]
set xlabel 'Courant I (\si{\milli\ampere})' # attention il faut parfois utiliser certains guillemets
# notamment quand on utilise la commande \si, il faut impérativement des primes '...'
set ylabel 'Tension U (\si{\volt})'
# Création du fit des données
# ---
# la fonction de fit
f(x)=a*x+b
g(x)=c*x+d
h(x)=e*x+f
i(x)=g*x+h
j(x)=i*x+j
# l'index 0 indique que les données sont dans le premier tableau du fichier
# on utilise (u) les deux premières colonnes et les paramètres de fit sont a et b
fit f(x) 'data9.txt' index 0 u 2:1 via a,b
fit g(x) 'data9.txt' index 1 u 2:1 via c,d
fit h(x) 'data9.txt' index 2 u 2:1 via e,f
fit i(x) 'data9.txt' index 3 u 2:1 via g,h
fit j(x) 'data9.txt' index 4 u 2:1 via i,j
#,\ f(x) title 'Régres. linéaire.' lc 'blue'
R1 = a*1000
e1 = (47-R1) / 47 *100
title_f(a,b) = sprintf('\(R_{pente}\;\;\;\,\) = \SI{%.1f}{\ohm} ; \(e_{mes.}\) = %.1f\%', R1, e1)
R2 = c*1000
e2 = (100-R2) / 100 *100
title_g(c,d) = sprintf('\(R_{pente}\;\;\;\,\) = \SI{%.1f}{\ohm} ; \(e_{mes.}\) = %.1f\%', R2, e2)
R3 = e*1000
e3 = (177-R3) / 177 *100
title_h(c,d) = sprintf('\(R_{pente}\;\;\;\,\) = \SI{%.1f}{\ohm} ; \(e_{mes.}\) = %.1f\%', R3, e3)
R4 = g*1000
e4 = (454-R4) / 454 *100
title_i(c,d) = sprintf('\(R_{pente}\;\;\;\,\) = \SI{%.1f}{\ohm} ; \(e_{mes.}\) = %.1f\%', R4, e2)
R5 = i*1000
e5 = (1193-R5) / 1193 *100
title_j(c,d) = sprintf('\(R_{pente}\;\;\;\,\) = \SI{%.1f}{\ohm} ; \(e_{mes.}\) = %.1f\%', R5, e5)
plot [0:50][0:12]\
'data9.txt' index 0 u 2:1:4:3 title '\(R_{anneaux}=\SI{50}{\ohm}\) ; \(R_{mes.}=\SI{47}{}\pm\SI{2.5}{\ohm}\)' pt 4 w xyerrorbars,\
f(x) title title_f(a,b) lc 'green',\
'data9.txt' index 1 u 2:1:4:3 title '\(R_{anneaux}=\SI{100}{\ohm}\) ; \(R_{mes.}=\SI{100}{}\pm\SI{3}{\ohm}\)' pt 4 w xyerrorbars,\
g(x) title title_g(c,d) lc 'red',\
'data9.txt' index 2 u 2:1:4:3 title '\(R_{anneaux}=\SI{180}{\ohm}\) ; \(R_{mes.}=\SI{177}{}\pm\SI{4}{\ohm}\)' pt 4 w xyerrorbars,\
h(x) title title_h(e,f) lc 'blue',\
'data9.txt' index 3 u 2:1:4:3 title '\(R_{anneaux}=\SI{500}{\ohm}\) ; \(R_{mes.}=\SI{454}{}\pm\SI{6,6}{\ohm}\)' pt 4 w xyerrorbars,\
i(x) title title_i(g,h) lc 'violet',\
'data9.txt' index 4 u 2:1:4:3 title '\(R_{anneaux}=\SI{1200}{\ohm}\) ; \(R_{mes.}=\SI{1193}{}\pm\SI{14}{\ohm}\)' pt 4 w xyerrorbars,\
j(x) title title_j(i,j) lc 'orange'