movstd
Moving standard deviation
Syntax
Description
M = movstd(
returns
an array of local A
,k
)k
-point standard deviation values. Each
standard deviation is calculated over a sliding window of length k
across
neighboring elements of 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 taken over
only the elements that fill the window. M
is the
same size as A
.
If
A
is a vector, thenmovstd
operates along the length of the vectorA
.If
A
is a multidimensional array, thenmovstd
operates along the first dimension ofA
whose size does not equal 1.
M = movstd(___,
specifies
a normalization factor for any of the previous syntaxes. When w
)w
= 0
(default), M
is normalized by k-1
for
window length k
. When w = 1
, M
is
normalized by k
.
M = movstd(___,
specifies the dimension of 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
.
M = movstd(___,
specifies
whether to include or omit nanflag
)NaN
values in A
.
For example, movstd(A,k,"omitnan")
ignores NaN
values when computing each standard deviation. By default,
movstd
includes NaN
values.
M = movstd(___,
specifies
additional parameters for the standard deviation using one or more name-value pair
arguments. For example, if Name,Value
)x
is a time vector, then
movstd(A,k,"SamplePoints",x)
computes the moving standard
deviation relative to the times in x
.