movstd
R2026bMoving standard deviation
Syntax
Description
returns the local S = movstd(A,k)k-point standard deviation values. Each standard deviation is calculated over a
sliding window of length k across neighboring elements in
A. When k is odd, the window is centered
about the element in the current position. When k is even, the
window is centered about the current and previous elements. The window size is
automatically truncated at the endpoints when there are not enough elements to fill
the window. When the window is truncated, the standard deviation is calculated over
only the elements that fill the window. S is the same size as
A.
If
Ais a vector, thenmovstdoperates along the length of the vectorA.If
Ais a multidimensional array, thenmovstdoperates along the first dimension ofAwhose size is greater than 1.If
Ais a table or timetable, thenmovstdoperates along the variables ofA. (since R2025a)
specifies the dimension of S = movstd(___,w,dim)A to operate along for any of the
previous syntaxes. Always specify the weight w from the previous
syntax when specifying dim. For example,
movstd(A,k,0,2) operates along the columns of a matrix
A, computing the k-element sliding
standard deviation for each row. The normalization factor is the default,
k-1.
specifies additional options for the standard deviation using one or more name-value
arguments. For example, if S = movstd(___,Name=Value)x is a time vector, then
movstd(A,k,SamplePoints=x) computes the moving standard
deviation relative to the times in x.

![movstd(A,[2 1]) computation. The elements in the sample window are 4, 1, 3, and 5, so the resulting local standard deviation is 1.71.](movstd_windowing.png)

