|
From: Guilherme P. <gpo...@gm...> - 2010-02-23 04:25:20
|
Hi! I am a new user of gnuplot and my version is 4.2 patchlevel 6. I'm having a trouble with "fit" function when I use xdata time as X axis values. Here my script and data set. # watthour.gnu # =========== < cut here reset set terminal png size 800,500 font comic 12 enhanced truecolor set output "watthour.png" set xdata time set timefmt "%Y/%m/%d %H:%M" set label "Powered by GnuPlot 4.2" at graph 0.87,-1.7 center font "lhandw,10" textcolor rgb "#800080" show label set key below left vertical title "Variables" set border 3 set xtics rotate by 45 offset graph -0.075,-0.30 textcolor rgb "#008000" nomirror set ytics nomirror textcolor rgb "#008000" nomirror set format x "%d%b %Hh" set format x "%N" set format y "%6.1f" set xtics 86400 set ytics 2 set mxtics 12 set mytics 5 f(x)=a + b*x fit f(x) "watthour.txt" using 1:4 via a,b set title "Kilowatts - 2010\n Fit Model: f(t) = a + b.t " font "comic, 12" textcolor rgb "#800080" plot f(x) t"Projection" with lines 2, "watthour.txt" using 1:4 t "KWh" with points 3 # =========== < cut here # watthour.txt # =========== < cut here #YYYY MM DD hh mm U KWh 2010/02/19 23:36 3 22835.1 2010/02/20 08:05 3 22839.0 2010/02/20 10:32 3 22839.8 2010/02/20 11:32 3 22840.1 2010/02/20 12:49 3 22840.8 2010/02/20 23:28 3 22845.5 2010/02/21 01:40 3 22846.8 2010/02/21 13:45 3 22851.5 2010/02/21 22:09 3 22855.6 2010/02/22 18:06 3 22864.5 2010/02/22 22:14 3 22866.0 # =========== < cut here I believe that are a problem with "fit" function when I use xdata time, because X values are converted to second since 2000/01/01 ( I think! ) and this number get big compared to Y values... the algorith to "fit" the data to the model has some dificulties with this. The curve not pass near of the points, of course, it not pass over them, but should be pass so near because it is a adjustment with "least squares"!! My data set file don't have outliers to cause the problem that I report here. I tried do some tests with this same data, changing time near year 2000 and the fit curv was diferent, but it curve should be the same angular coeficient. Is it a bug or I'm commiting a mistake. Thank you very much! __________________________________ Guilherme Poleszuk dos Santos Rosa São Paulo, Brazil |