Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Fitting time series using an annual sine and cosine
Posted:
Dec 3, 2012 10:36 PM


On Tuesday, December 4, 2012 3:27:08 PM UTC+13, University wrote: > Hi, > > I'm working with GRACE data and I want to fit the monthly time series using an annual sine and cosine, and semiannual sine and cosine.
Say your data are in column vector y which represents nmon months of data: dtm=365.25/12; % Interval in days t=[0:nmon1]'*dtm; wSat=2*pi/365.25*t; wSsat=2*pi/(365.25/2)*t;
A=[cos(wSat) sin(wSat) cos(wSsat) sin(wSsat)]; coef=A\y; % Coefficients of cos and sin terms



