I didn't realise the example data I inserted had posted as linear text. I'm not sure how to rectify this so apologies but I hope it's clear that the 'Time' data is 77237.3, 77247.3, 77276.0 ...and the SO4 data is 0.165, 0.177, 0.137...
How do I average a time series with uneven intervals?
12 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a time series which has vector values recorded at a frequency greater than 1 hz (1 measurement per second) with uneven intervals and I would like to average the vector values for each second so that I effectively have a time series with a 1 hz frequency.
Is it possible to create a loop with variable increments to achieve this? Or might ACCUMARRAY be more suitable?
Here is an example of my data set.
Time SO4 77237.3 0.165 77247.3 0.177 77276 0.137 77304.4 0.093 77304.4 0.093 77332.8 0.103 77361.3 0.072
Any help would be greatly appreciated. Thanks
采纳的回答
Roger Stafford
2013-6-28
One possibility is to use 'interp1' set to interpolate at some appropriate multiple of one hertz, say, 20 Hz. You can select the type of interpolation that best suits your data. Read the documentation at
http://www.mathworks.com/help/matlab/ref/interp1.html
Then take a straightforward average over each twenty (or whatever multiple you choose) points to get the average for the corresponding second.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!