data
financial time series object (fints) following columns:
date time number
i have data every hour every single day 2 years.
problem
i want have average every hour past year. in other words, want have time column 24 hours in day , corresponding number should average of past days @ same hour.
what tried
i've tried looking @ perav, tsmovavg function , accumarray function. other ideas? new matlab don't know how loop on time series data. there must sort of way though considering fact time series object using time series specific functions.
edit: i'd leave in time series ideally.
assuming data has been stored in matrix f
, "date" year , "time" hour, can use for
loop print average of same time during different days of particular year y
:
for t=unique(f(:,2)) mean(f(f(:,2)==t & f(:,1)==y) ,3) end
explanation: using unique
can retrieve different values of "time". 2 conditions inside mean
make sure mean of same "time" in particular year.
Comments
Post a Comment