Hello all,
I am having some issues understanding curve fit and I was wandering if anyone could help me here. Attached is a plot of 10 years of data and the red line is the 10 year average across 365 days.
See here:
I want to use curvefit to best fit of the red line.
In my code I have
X=float(indgen(365)+1))
y=mean(p(*,*,/nan) (red line)
weight=fltarr(366)
weight(*)=1.0
A=[800.,540.,220.,110.]
p_curve=(x,y,weight,A,sigma,function_name='f_series',/noderivative,status=stati)
PRO f_series, x, A, F , pder
x=float(indgen(366)+1)
F = A[0]*sin(2*!pi*x) + A[1]*cos(2*!pi*x) + A[2]*sin(4*!pi*x) + A[3]*cos(4*!pi*x)
;stop
;If the procedure is called with four parameters, calculate the
;partial derivatives.
IF N_PARAMS() GE 2 THEN $
pder = [A[0]*sin(2*!pi*X) + A[1]*cos(2*!pi*X) + A[2]*sin(4*!pi*X) + A[3]*cos(4*!pi*X), [replicate(1.0, N_ELEMENTS(X))]]
; stop
;stop
END
The blue line I plot the p_curve result. Shouldn't the result of the p_curve be like the red line but smoothed?
|