movingstd & movingstd2

A (fast) windowed std on a time series (or array)
12,1K téléchargements
Mise à jour 8 avr. 2016

Afficher la licence

Occasionally I see a request for computation of a running, windowed standard deviation. This is easily accomplished using filter and the alternative formula for the standard deviation:
std = sqrt((sum(x.^2) - n*xbar.^2)/(n-1)).
movingstd allows you to specify forward, backward or central windows of any desired length. It patches the ends, shortening the window as necessary.
movingstd2 is now included, allowing a moving window standard deviation on 2-dimensional arrays. (I suppose I could easily enough implement movingstdn if that becomes of interest.)

Citation pour cette source

John D'Errico (2024). movingstd & movingstd2 (, MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R14SP1
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux

A inspiré : slidefun

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version

movingstd2 included

strncmpi instead of strmatch for tests
Pre-centered and pre-scaled now

Fix the case of complex std results due to floating point arithmetic.

Documentation change to explicitly state the behavior at the end of the series.