Moving averages / Moving median etc
Updated 16 Jun 2011
MOVING will compute moving averages of order n (best taken as odd)
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'.
legend('x','7pt moving mean','7pt moving median','7pt moving max','location','best')
Aslak Grinsted (2023). Moving averages / Moving median etc (https://www.mathworks.com/matlabcentral/fileexchange/8251-moving-averages-moving-median-etc), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired: downsample_ts, scatstat1 local statistics of scattered 1d data, scatstat2 2D local statistics, Nth Octave Test Signal, Nth_Oct_Hand_Arm_&_AC_Filter_Tool_Box, Continuous Sound and Vibration Analysis, Calibrated Spectral Analysis
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.