Info
此问题已关闭。 请重新打开它进行编辑或回答。
How do I compute a vector of date strings representing the longest time period covered by all elements of a given set of time series variables?
1 次查看(过去 30 天)
显示 更早的评论
I'm working with several time series objects, each covering different time spans, sampled at different frequencies, and with some scarce data as well.
I would like to identify the longest possible time period which is covered by all my time series variables. I realise this can be done manually, but I would like to find an elegant way to automate this. Some of my data are sampled at irregular intervals and the frequencies differ.
- Assuming I have already ensured homogenous sampling frequency, what is the most elegant way to compute a time vector that contains the dates which represent the above mentioned largest common time period I am looking to identify?
- Is there a way to do this when sampling frequencies are not homogenous and when working with scarce data, so that the time vector computed could then be used for interpolation? Which order is generally recommended and why?
Suggestions are greatly appreciated!
3 个评论
dpb
2014-9-11
As an aside, you don't have to generate the full-blown intermediary matrix for datenum -- just use the vector input form -- I added the beginning/end years as variables for some generality in use:
yr1=1999; yr2=2013;
time=datestr(datenum(yr1,[1:(yr2-yr1+1)*12].',1)); % #yrs*12 months
...I would like to write a script which identifies the first and last point in time covered by each variable (the first and last object in Ts.Time)...
But there's the rub in the question and the one you didn't answer -- what's the sampling time within these time series? Are there monthly values on the first of month, just irregularly spaced or is it a time stamp that is just the real-time clock at the time the data are recorded? What granularity is significant?
The first/last points is simple -- it's simply min/max of the array of datenums or if they're presumably ordered the first/last entry of each series. It's the above detail of what's in between that's the quandary in what you're looking for...
回答(0 个)
此问题已关闭。
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!