Moving averages / Moving median etc

Calculates moving averages (or median/fun) of a timeseries.
15,9K download
Aggiornato 16 giu 2011

Visualizza la licenza

MOVING will compute moving averages of order n (best taken as odd)

Usage: y=moving(x,n[,fun])
where x is the input vector (or matrix) to be smoothed.
m is number of points to average over (best odd, but even works)
y is output vector of same length as x
fun (optional) is a custom function rather than moving averages

Note:if x is a matrix then the smoothing will be done 'vertically'.


Example:

x=randn(300,1);
plot(x,'g.');
hold on;
plot(moving(x,7),'k');
plot(moving(x,7,'median'),'r');
plot(moving(x,7,@(x)max(x)),'b');
legend('x','7pt moving mean','7pt moving median','7pt moving max','location','best')

Cita come

Aslak Grinsted (2026). Moving averages / Moving median etc (https://it.mathworks.com/matlabcentral/fileexchange/8251-moving-averages-moving-median-etc), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R14
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Smoothing in Help Center e MATLAB Answers
Versione Pubblicato Note della release
1.1.0.0

added Screenshot, updated description

1.0.0.0

Made more flexible and more robust.