Estudiantes, laboratorios y gnuplot: procesamiento de datos

. , . , , .  , gnuplot.






gnuplot

Gnuplot – , , 1986 . gnuplot ,   Linux, OS/2, MS Windows, OSX, VMS . gnuplot MS Windows gnuplot.info«Download» sourceforge.net.   – 30 , 100 . 





( ), «Select Additional Tasks», wxt, «Add application directory to your PATH environment variable». , «gnuplot» «gnuplot console version». , , :





pwd



, , gnuplot.

plot sin(x)



wxt \ sin (x).





gnuplot ( ), , . gnuplot help . gnuplot MS Windows ( Notepad).





, « ». - , .





, . , . , , . .





U \ theta :





U (\ theta) = U_0 \ cos ^ 2 (\ theta- \ theta_0),

U_0 – , \ theta_0– .





 

gnuplot , U \ theta. , . , . , . , model.gpl



gnuplot- : 





reset #       gnuplot
set angles degrees    #      
set xrange [0:350]    #     
set samples 36        #      
set format x "%5.1f"  #      
set format y "%5.3f"  #    
#   -   '' 
#  ,     
#      D.   
# gnuplot  - ,  rand(x):
err(D) = D * cos(360*rand(0))*sqrt(-2*log(rand(0))) 
#      :
U(x) = Uo * cos(x + err(D) - To)**2 + B 
Uo = 0.65  #  Uo
To = 71.   #  θo
B  = 0.02  #        
D  = 1.0   #        
set table "exp.dat" #       
plot U(x)           #    
unset table         #  
      
      



gnuplot load 'model.gpl'.



, , , cd 'your_path'



. c



exp.dat



, :





# Curve 0 of 1, 36 points
# Curve title: "U(x)"
# x y type
  0.0 0.089  i
 10.0 0.176  i
 20.0 0.283  i
 30.0 0.395  i
 40.0 0.505  i
 50.0 0.595  i
 60.0 0.643  i
 ...
      
      



( ). . - :





\ chi _ {\ nu} ^ 2 = \ frac {\ chi ^ 2} {\ nu} = \ frac {1} {\ nu} \ sum_i \ frac {(Y_i - f (X_i)) ^ 2} {\ sigma_i ^ 2}.
  • \ nu \ chi ^ 2 ( ) f (x),





  • X_i– x, ,





  • Y_i – X_i,





  • f (X_i)– X_i,





  • \ sigma_i – Y_i \ langle Y_i \ rangle.





gnuplot \ chi ^ 2 / \ nu WSSR / NDF, «Weighted Sum of Squared Residuals» «Number of Degrees of Freedom».





, / , «» . , \ chi ^ 2. gnuplot fit, — . «fit function to data» « ».





look.gpl



gnuplot.





reset
set angles degrees
f(x) = Uo * cos(x-To)**2 + B            #   
Uo  = 0.6                               #  Uo
To = 10                                 #  To
B  = 0.05                               #  B
set fit nolog         #        
#     -,  1  
# "exp.dat"   X[i],   -   Y[i].   
#      Uo, B, To
fit f(x) "exp.dat" using 1:2  via Uo, To, B
#        
L = sprintf(" : {/Symbol s} = %.2f []", 1000*FIT_STDFIT) 
#         
T = sprintf("   {/Symbol q_0} = %.2f° ± %.2f°", To, To_err)
set title T #    
set grid    #     
set key box width -14 #      
set xlabel '   {/Symbol q} [ ° ]'
set ylabel '   U [  ]'
set yrange [0:0.8] #     
set terminal png size 800, 600 #    - png 
set out 'look.png' #     
#      :
plot f(x) with line title L ls 3 lw 2, \
"exp.dat" u 1:2 title '' with points ls 7 ps 1.5 
set out #  
      
      



«\» . gnuplot load 'look.gpl'



, look.png



:





, , « » . \ theta_0 0.2 . , \ sigma \ simeq 9 . ?





fit



( №11 look.gpl), , , . . « » \ sigma_i . () ? : \ sigma_i -, , – 8.88 , .





, , . , U (\ theta) V (\ theta):





V (\ theta) \ equiv \ frac {\ parcial U (\ theta)} {\ parcial \ theta} = U_0 \ sin (2 (\ theta_0- \ theta)).

(. model.gpl



) «» , 1 . , . , ( ), pdf.





reset
set angles degrees
f(x) = Uo * cos(x-To)**2 + B      #   
v(x) = Uo * sin(2*(To-x))*pi/180  #  f(x)
Uo  = 0.6                         #  Uo
To = 10                           #  To
B  = 0.05                         #  B
dT = 1.0                          #   
set fit nolog
#      (- -)
fit f(x) "exp.dat" using 1:2             via Uo, To, B
#      ( -)
fit f(x) "exp.dat" using 1:2:(dT*v($1)) via Uo, To, B
L = sprintf(": {/Symbol c^2}/NDF = %.1f/%2d\n \
: %.2f \%", FIT_WSSR, FIT_NDF, 100*FIT_P) 
T = sprintf("   {/Symbol q_0} = %.2f° ± %.2f°", To, To_err)
set title T #    
set key box left opaque  width -12 spacing 2
unset border #   
unset xtics  #    x
unset ytics  #    y
set polar    #     
set grid polar linetype 2 lc rgb 'black' lw 0.25 dashtype 2
set rtics 0.1 format '%.1f'
unset raxis
Umax = 0.76  #   
set rrange [0:Umax]
set rlabel 'U_{} []'
set trange[0:360]
set for [i=0:330:30] label at first Umax*cos(i), \
first Rmax*sin(i) center sprintf('%d°', i)
set terminal pdf background rgb '0xFFFFF0' size 5, 5 #   - pdf 
set out 'closelook.pdf' #     
plot f(t) with line title L ls 3 lw 2, \
"exp.dat" u 1:2:(dT*v($1)) title '' with err ls 7 ps 0.5 
set out #  
      
      



- closelook.pdf.





- \ chi ^ 2 / \ text {NDF} = 33,9 / 33. - gnuplot (p-value) , . - 42%.





gnuplot, , - . . , , .








All Articles