Hi,
I must be being blind here but I can't see my error. I have the
following snip to plot some data, a fitted line and the difference
from that fitted line:
c=0;m=1;
f(x)=x*m+c;
fit f(x) datafile using 1:2 via m,c;
set terminal svg size 800 600
set output "dac-2008.svg"
plot datafile using 1:(($2)/1.0) w l title "resampled DAC output"\
, f(x) with lines title "lin. regression fit" \
, datafile using 1:( ($2-f($1))*1.0 ) title "difference error"
;
unset output
The DAC output and the fitted line come out as expected but the
difference seems the same as the first plot implying that the function
is evaluating to zero in my difference line.
Looking at the output of gnuplot as it does the fit would explain this
Final set of parameters Asymptotic Standard Error
======================= ==========================
m = 5.78027e-05 +/- 6.513e-08 (0.1127%)
c = 0.00413971 +/- 0.002064 (49.86%)
What I can't understand is that the plots correctly, y data goes 0-3 ;
x data 0-16 , so my slope should be about 0.2
The odd thing is the plot of f(x) look perfect and does not have a
slope of 6e-05
Must be something silly I'm overlooking .
TIA for any help.


|