Fast moving average

A fast implementation of the moving average filter for long kernels.

ダウンロード: 1K

更新 2012/1/19


In terms of behavior, this is an alternative to filter() for a moving-average kernel. The running time does not grow with filter length beyond N=500.

The code uses a variant of the cumsum-trick, although not the "garden variety" but in a way that does not run into numerical issues for long data arrays.

The function is suitable for incremental (online) processing.


Christian Kothe (2023). Fast moving average (, MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2011b
Windows macOS Linux

ヒントを与えたファイル: downsample_ts

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート

The N<500 case is now correctly implemented... (had a dumb error before)

Fixed an issue pointed out by Jan Simon (failed to determine along which dimension to filter when the signal was a scalar) and updated the docs.