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

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

What is the time you write?
In matlab each day is 1. for example today it 73586 and tomorrow will be 73587. so month need to be in difference of 28, 30 or 31.
the time is in year unit if you multiply .0438 with 365 it will be 15th of 1st month and like that
The time is in yearly basis 2004.0438 if converted to day it become 15th day of the month
You can take the average of all time that are the same natural number after multiply by 365.
if X is in year, take average of all data that have the same month (second data) in:
datevec(X*365)
I need the monthly average of the daily time series.......which have same time element as that of monthly time series
I need monthly average of daily data set....having same time as monthlytime series
Doesn't look like enough precision that will match and don't appear to be any even increments...
What, specifically, does ...monthly average of daily data set....having same time as monthlytime series mean?
The dates given look like
>> dm=[2004.0438;2004.126];
>> y=fix(dm);
>> mdy=dm-y;
>> datestr(datenum(y,1,1)-1+mdy*365)
ans =
15-Jan-2004 23:41:16
14-Feb-2004 23:45:36
>>
Those aren't any even values; so it'll be difficult I'd guess to find a precise set of values that match. How many daily values are there per monthly set--are the monthly averages actual averages by month of varying days/month at some more-or-less random point or what? Doesn't seem to be any consistent pattern to use.
The monthly time series is given on mid day of a month and there is some gap in that also. Now from my daily time series I want to take monthly mean such that the mean time is the mid day of the month. like 15th of january . 14th of february like that...please help me...
Do you want the mean to be the mean of the values that fall within a given calendar month (e.g. all the values in January 2004), or all the values that fall within, say, 15 days of the time at the centre of the month, or some other definition?
Another question: the decimal year format is not well-defined because of leap years. To get from the fractional part to the number of days from the start of the year, should we multiply by 365.25 in all cases, or by 366 in leap years and 365 in other years?
OK, let me try and ask another way. The second monthly time is 15 Feb 2004 at 00:30 if you assume there are 365.25 days in a year even in 2004 (a leap year). For the corresponding mean, do you want to average all the events 15 days either side (from 00:30 on 31 January to 00:30 on 1 March), or do you want all the events in February?
We need...we need to see...more cooperation and less terseness and lack of responsiveness to the questions raised.
For example, you've yet to answer the question of what is the reference number of days/year in your date normalization.
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:
  1. Do you want the averages to be over calendar months, or over fixed time periods centred on the monthly reading times?
  2. 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?
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"

Sign in to comment.

Answers (1)

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.

1 Comment

my time vaector is not i year month day wise it is in yearly time scale, if i do with datestring also it is giving exact value

Sign in to comment.

Asked:

on 16 Sep 2014

Commented:

dpb
on 17 Sep 2014

Community Treasure Hunt

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

Start Hunting!