movmean 'SamplePoints'

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 Commento

Rik
Rik il 1 Mag 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Graphics Objects in Centro assistenza e File Exchange

Richiesto:

il 1 Mag 2019

Commentato:

Rik
il 1 Mag 2019

Community Treasure Hunt

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

Start Hunting!

Translated by