From: Jenna on
I am sure that this is probably easy to solve but I don't seem to be having any luck myself so if some one can help that would be great.

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.

Any help will be much appreciated

Charlotte
From: dpb on
Jenna wrote:
....
> 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.
....

How are you storing the series now--as an array from 1-N?

You need to create an independent variable for the existing locations
that is proportional to the number of days between them--either 365 or
366 depending on leap year. Once you've got that, then to generate a
vector of days for the interpolant is essentially trivial.

--
From: dpb on
dpb wrote:
> Jenna wrote:
> ...
>> 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.
> ...
>
> How are you storing the series now--as an array from 1-N?
>
> You need to create an independent variable for the existing locations
> that is proportional to the number of days between them--either 365 or
> 366 depending on leap year. Once you've got that, then to generate a
> vector of days for the interpolant is essentially trivial.

And of course, I meant days/month between entries, not /year...

--
From: kevin on
"Jenna " <cljm1g08(a)soton.ac.uk> wrote in message <h7r1du$52p$1(a)fred.mathworks.com>...
> I am sure that this is probably easy to solve but I don't seem to be having any luck myself so if some one can help that would be great.
>
> 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.
>
> Any help will be much appreciated
>
> Charlotte

A possible approach to using interp1 (yi = interp1(x,Y,xi)).
You could work out the day on which you have your monthly data, starting from the Jan 2001. This would be the vector x. E.g. if the first month was on 1st Jan & the second is on the 1st of feb, then x(1) = 1 & x(2) = 32. Your monthly data vector goes in Y & xi is 1:N where N is the number of days over the 7 years. I think that should work

Kevin
From: Jenna on
"kevin " <kevin.spamfilter.brownhill(a)kcl.ac.uk> wrote in message <h7r57q$efk$1(a)fred.mathworks.com>...
> "Jenna " <cljm1g08(a)soton.ac.uk> wrote in message <h7r1du$52p$1(a)fred.mathworks.com>...
> > I am sure that this is probably easy to solve but I don't seem to be having any luck myself so if some one can help that would be great.
> >
> > 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.
> >
> > Any help will be much appreciated
> >
> > Charlotte
>
> A possible approach to using interp1 (yi = interp1(x,Y,xi)).
> You could work out the day on which you have your monthly data, starting from the Jan 2001. This would be the vector x. E.g. if the first month was on 1st Jan & the second is on the 1st of feb, then x(1) = 1 & x(2) = 32. Your monthly data vector goes in Y & xi is 1:N where N is the number of days over the 7 years. I think that should work
>
> Kevin

Thanks Kevin this sounds like it might work I will give it a go.
 |  Next  |  Last
Pages: 1 2
Prev: ADC in matlab
Next: Asynchronous Function Execution