Clear Filters
Clear Filters

movmean 'SamplePoints'

15 views (last 30 days)
Shlomit Sharoni
Shlomit Sharoni on 1 May 2019
Commented: Rik on 1 May 2019
I am trying to cunduct a moving average with variable sample points, which depands on the time vector, in this example, every 2 time units
x = [1 2 3 4 2 5 3 ]
time = [ 1 1 2 2 3 4 7]
yd = movmean(x,2,'SamplePoints',time);
and I get the followinf error:
'Error using movmean
'SamplePoints' value contains duplicates.'
How can I fix it? and I also want to find the standard deviation in the same way...
Furthermore 'movmean' apply only from MATLAB 2017, is there a way to do it in earlier versions?
  1 Comment
Rik
Rik on 1 May 2019
You may have to write it yourself if you want to support duplicate timepoints. The clearly states that the SamplePoints must be unique and sorted.
Also, movmean was introduced in R2016a, not 2017.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!