From: Yvonne on
Hi,

I am trying to do some interpolation of timeseries data (24 hours) over different months but my timeseries are not continous.
Here is an example of the timeseries:
A= [2007 11 19 0
2007 11 19 23
2008 3 15 0];

I have the data for November 2007 with hourly data, then I have data for March 2008 with hourly data. How do I interpolate between the hourly monthly data to make it hourly data between November 2007 to March 2008?

Thank you
From: Sean on
"Yvonne " <hwt3(a)waikato.ac.nz> wrote in message <hrcsbs$987$1(a)fred.mathworks.com>...
> Hi,
>
> I am trying to do some interpolation of timeseries data (24 hours) over different months but my timeseries are not continous.
> Here is an example of the timeseries:
> A= [2007 11 19 0
> 2007 11 19 23
> 2008 3 15 0];
>
> I have the data for November 2007 with hourly data, then I have data for March 2008 with hourly data. How do I interpolate between the hourly monthly data to make it hourly data between November 2007 to March 2008?
>
> Thank you

There is probably another (better/easier) way using cells but this is one way:

-Calculate what each day is in relation to the first hour of the first day being zero.
-Then convert each full date/time (year, month, day,hour) to the hours past the first time, put these all in a vector.
-You now have a vector with all the times for which you have data.
-Run interp1 on this vector.

There is probably a file on the FEX to help with getting day of year.
From: TideMan on
On Apr 30, 9:06 am, "Yvonne " <h...(a)waikato.ac.nz> wrote:
> Hi,
>
> I am trying to do some interpolation of timeseries data (24 hours) over different months but my timeseries are not continous.
> Here is an example of the timeseries:
> A= [2007        11      19      0              
>      2007       11      19      23              
>      2008       3       15      0];
>
> I have the data for November 2007 with hourly data, then I have data for March 2008 with hourly data. How do I interpolate between the hourly monthly data to make it hourly data between November 2007 to March 2008?
>
> Thank you              

% Convert your times to Matlab days:
t=datenum(A(:,1),A(:,2),A(,3),A(:,4),0,0);
% Generate the new times at hourly intervals
tt=[t(1):1/24:t(end)]';
% Interpolate
yy=interp1(t,y,tt);