Using the function movmean
7 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 23 Apr 2017
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 Comments
nlm
on 7 May 2020
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
on 7 May 2020
Use unique() to remove duplicates. Start a new question and attach your data if you still have problems.
See Also
Categories
Find more on Data Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!