Quoting laura <lau...@ho...>:
> Hello,
> I want to fit a curve to data using the least square method.
> I have try to do the next but doesn't work:
> fit 'datafile.dat', y=a*x+b, via a,b
> My data see thas:
> *
> *
> *
> *
> *
> *
>
>
> What can i do? Thank you very much.
You need to this:
1.first define the function you want to fit with: by
f(x)=a*x+b
2.let us say that your xdata values are in column 2 in datafile.dat,
and your ydata values are in column 4 then your fitting command should
read:
fit f(x) 'datafile.dat' u 2:4 via a,b
that's it
if you need more info consult the documentary of gnuplot by :
help fit
Ramzi Alsallaq
Florida State University
----------------------------------------------------------------
|