I having two time series one is monthly and another one is in daily, now i need to average the daily time series to the particular time values of monthly time series
4 views (last 30 days)
Show older comments
the sample time series is such that
for monthly: 2004.0438 1.975
2004.126 2.985
...............................
for daily : 2004.001360 .00567
2004.004100 .00458
................................
now i want to get the monthly average from daily time series whose time value should {whose time column should} match with the monthly time series, ie in monthly average of daily time series I need the time value as 2004.0438 2004.126 just as monthly time series
16 Comments
David Young
on 17 Sep 2014
Edited: David Young
on 17 Sep 2014
I'm sorry, I can give you a solution, and so could dpb, but we need to know which solution you would like. I think maybe you don't understand my questions, but I've put them as clearly as I can. Last try:
- Do you want the averages to be over calendar months, or over fixed time periods centred on the monthly reading times?
- Does a fraction of a year mean the number of days divided by 365.25 always, or the number of days divided by 366 in leap years and 365 in other years?
dpb
on 17 Sep 2014
Does a fraction of a year mean the number of days divided by 365.25 always, or the number of days divided by 366 in leap years and 365 in other years?
Or the third alternative of 365 days always???
Or, perhaps the fourth -- "I don't know; pick one"
Answers (1)
Yona
on 17 Sep 2014
find the value of middle of month by
m=1:12;
d=[1 0 1 0 1 0 1 1 0 1 0 1];
mid = datenum(0,m,15+d)/365
when m is the month and 16 or 15 depend if the month have 30 or 31 days.
To take the mean of data, find the value of month:
str = datenum(0,m,1)/365;
and then look on mdy. if it between str(1) -> str(2) it in january. ext.
See Also
Categories
Find more on Time Series Events in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!