|
From: <pl...@pi...> - 2013-10-20 23:48:20
|
Hi,
I have a curious glitch in plotting the sum of three cosines.
set samples 1700
twopi=2*pi
c1(x)=a1*cos(twopi*(x-yz+ph1)/p1)
c2(x)=a2*cos(twopi*(x-yz+ph2)/p2)
c3(x)=a3*cos(twopi*(x-yz+ph3)/p3)
f3(x)=c1(x)+c2(x)+c0+c3(x)
a1=a2=a3=1; c0=3.; yz=1958; p1=1.0;p2=0.5;p3=.25; ph1=ph2=ph3=.1
a3=1;ph3=0.1;p3=0.25
fit f3(x) datafile u (($1)/365.25+1945):2 via
a1,a2,c0,ph1,ph2,p2,p3,a3,ph3
plot datafile u (($1)/365.25+1945):(f3($1)) w l
data either side of that point seem fine and if I use it directly with
plot "-" I don't get the glitch.
Closing gnuplot session and repeating the plot from file gives same
result seen in attached png flie.
For the benefit of the list that don't see the file, it looks like a
cosine ranging -0.07 and + 0.014 pk to pk with some small ripple with
sporadic spikes ranging from 0.025 to 0.075 , glitches are just single
points.
Irrespective of the actual data fed in , I fail to see how the sum of
cosines can have such glitches.
If anyone can explain how that could happen I'd like to know, otherwise
it looks like a bug.
Thanks, Peter.
plot "-" u (($1)/365.25+1945):(f3($1)) w l
22629 381.81
22636 381.88
22643 381.65
22650 382.62
22657 382.25
22664 381.37
22678 383.09
22685 383.59
22692 384.19
22699 383.76
22706 383.71
22713 383.64
22720 384.28
e
Final set of parameters Asymptotic Standard Error
======================= ==========================
a1 = 0.0486237 +/- 0.001654 (3.402%)
a2 = 0.0265777 +/- 0.001788 (6.728%)
c0 = 0.00416031 +/- 0.001169 (28.1%)
ph1 = -0.0557476 +/- 0.005409 (9.703%)
ph2 = 0.163801 +/- 0.009924 (6.059%)
p2 = 0.49982 +/- 0.0001585 (0.03171%)
p3 = 0.258274 +/- 0.0005954 (0.2305%)
a3 = -0.00192983 +/- 0.00202 (104.7%)
ph3 = -0.923156 +/- 0.06458 (6.996%)
G N U P L O T
Version 4.7 patchlevel 0 last modified 2012-10-16
Build System: Linux i686
|