From: Lars on
"Jenna " <cljm1g08(a)soton.ac.uk> wrote in message

> I have a dataset which contains one data point for each month over a seven year
> period (Jan 2001 -Dec 2007). I would like to interpolate the data linearly in order
> to produce daily values. However, I would like the number of interpolations
> between each of the original data points to be the same as the number of days in
> the corresponding month.
>
> I have tried using interp but you only seem to be able to interpolate the original
> dataset by a set interger value r and I don't seem to be having any better luck
> with interp1 either

Did you try this

x1=datenum(2001,01,01);
x2=datenum(2007,12,31);
xi=[x1:x2];
obsy= % year of your data points (column vector)
obsm= % month of your data points
obsd= % day ...
x=datenum(obsyr,obsm,obsd);
y= % your data points
yi=interp1(x,y,xi,'linear');

if your first and last data point is not on 2001-01-01 and 2007-12-31
you will have either to adjust x1 and x2, or allow interp1 to extrapolate
(see help text)

hth
Lars
First  |  Prev  | 
Pages: 1 2
Prev: ADC in matlab
Next: Asynchronous Function Execution