movmean 'SamplePoints'

15 次查看(过去 30 天)
Shlomit Sharoni
Shlomit Sharoni 2019-5-1
评论: Rik 2019-5-1
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 个评论
Rik
Rik 2019-5-1
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Array Geometries and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by