a) you are using 'set xdata time'. so the origin of the
coordinate system is ("01/01/2000" , 0).
that means that the point where 'c' is calculated (point of
origin) is far off the point where your data are:
appr. +2.8e+8 seconds.
this can not work.
for the function
f(x)=m*(x-2.8e+08) + c
the fit behaves a little bit better when setting 'c' to a value
near enough to 293255.
but in the end it will terminate with the message
Singular matrix in Invert_RtR
maybe it's because the fit is working at the limit of
computational accuracy? i'm not sure about that...
b) for data distributed on a horizontal line you should
use an appropriate function, e.g.
and the fit will converge after 4 steps.
> I am having some problems with the fit of a straight line.
> I want to get a line of best fit for the 3rd column.
> It really should give
> but I get
> m=close to 0
> I do not understand how I get a line of best fit that does not fit
> What am I doing wrong?
> 26/08/08 293449 293255
> 29/10/08 296787 293255
> gnuplot commands:
> set xdata time
> set timefmt "%d/%m/%y"
> set style data boxes
> set style fill solid 1 noborder
> set xrange [ "29/07/08":"29/01/09" ]
> set title "data"
> set xlabel "date"
> set ylabel "whatever"
> set grid
> f(x)=m*x + c
> fit [ "29/09/08":"28/10/08" ] f(x) dataset using 1:3 via m,c
> plot dataset using 1:2 title "line1", dataset using 1:3 title "line2" ,
> f(x) title "Trendline" lw 3
View this message in context: http://www.nabble.com/fit-function-weirdness-tp20218720p20225280.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.