Using the function movmean
8 次查看(过去 30 天)
显示 更早的评论
Hello, so i have a data set of average wave heights taken every 10 minutes for the last 60 years. I want to use the function 'movmean' to give an 8 week moving average of wave heights. Any idea how I might go about this?
0 个评论
回答(1 个)
Image Analyst
2017-4-23
10 minutes for 8 weeks is 8064 elements I believe. So just do
averageWaveHeights = movmean(waveHeights, 8064);
That's pretty obvious, so I'm wondering what the real problem is. Like your elements are actually not every 10 minutes or something. Even if they weren't exactly 10 minute, it wouldn't matter much as long as the total window width covers 8 weeks. Did you try movmean() at all yet? What was the problem you had with it?
3 个评论
nlm
2020-5-7
How to calculate a 10 day average when the timeseries has duplicate dates. I do not want to average the dupliate dates priorly. I want to include them in the 10 day average. When I use movmean, I get this error, any suggestions ?
Error using builtin
'SamplePoints' value contains duplicates.
Error in datetime/movmean (line 105)
y = builtin('_movmeandt', args{:});
Image Analyst
2020-5-7
Use unique() to remove duplicates. Start a new question and attach your data if you still have problems.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!