Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Fitting time series using an annual sine and cosine
Replies: 1   Last Post: Dec 3, 2012 10:36 PM

 Messages: [ Previous | Next ]
 Derek Goring Posts: 3,922 Registered: 12/7/04
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 semi-annual 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:nmon-1]'*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

Date Subject Author
12/3/12 University
12/3/12 Derek Goring