projecting values to future dates

1 view (last 30 days)
antonet on 25 Jun 2012
Dear all,
I have the following sequence of dates
The prices corresponding to these dates are given by the following cell vector
values =[
Each price represents a 4-week average. For instance, the first price is 8.0486. This price is not the price recorded at the date '02/11/08' but the average of the prices in the previous 4 weeks before the '02/11/08' date.
I want to interpolate each of these prices to all the dates that are included in the time interval that starts from the date immediately following the reported dates in the “dates” vector up to the end date of the corresponding month.
To be more precise, the end dates corresponding to the “dates “ vector are given by
So, I want to interpolate the first value 8.0486 to the dates that are included in the time-interval [‘3/11/08' - '30/11/08']
For the second value, 8.4678, no interpolation is needed as the reported date coincides with the end date of that month.
For the third value, 8.1981, I want to interpolate it to the dates that are included in the time-interval ['29/12/08'-'31/12/08'] and so forth.
My question is whether I could use the interp1() function as follows
Prices2 = interp1(datenum(Dates), values, datenum(Datesend) , 'linear')
The problem is by applying this function I obtain
So, my questions are
1) Could I use the interp1() when I use this frequency of data (4-week average prices)? Clearly the dates at which I want to interpolate the value 7.9911 are included in the interval ['23/02/09'- '28/02/09'] . But the prices recorded on the dates of this interval were also used for calculating the next value 8.1159. So there is this overlapping
2) Is there any other approach that you be used so as to notify Matlab that my sequence of dates has these peculiarities?
Thanks a lot
antonet on 25 Jun 2012
thanks. I will follow your guidelines and get back to you for advice, albeit I am trying 3 weeks with no success.
Thank you again

Sign in to comment.

Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by