Using gnuplot for fit a dataset
Gnuplot, not only a good program for plot datas and function, this program can fit your data easy.
If you have simple set of experimental data, for example a Free Fall, has here.
You can graph this easy, using gnuplot, after of type gnuplot, you can plot your data using
gnuplot> plot "freefall.dat"
So, we need the fit this data to one equationf of the form : h(x)=a*x*x + b*x + c
for a,b,c incognits, so the first step is define the function in gnuplot :
gnuplot> f(x)=a*x**2 + b*x +c
Finally we run the comand for find the values for a, b and c.
gnuplot> fit f(x) "freefall.dat" via a,b,c ;
Afther of the necesary iterarions, you have a results, has here :
Final set of parameters Asymptotic Standard Error
======================= ==========================
a = -4.9 +/- 1.67e-06 (3.409e-05%)
b = 5.01988e-06 +/- 8.632e-06 (171.9%)
c = 100 +/- 9.338e-06 (9.338e-06%)
correlation matrix of the fit parameters:
a b c
a 1.000
b -0.968 1.000
c 0.738 -0.861 1.000
With this, we have our new function : f(x) = -4.9*x*x+ 5E-6 * x + 100;
We can replot our data and the new data set with the command :
gnuplot> replot f(x)
Thanks to Claudia, for this TIP
JP.
