movmad
Moving median absolute deviation
Syntax
Description
M = movmad(
returns
an array of local A
,k
)k
-point median absolute deviations
(MADs), where each MAD is calculated over a sliding window
of length k
across neighboring elements of A
. M
is
the same size as 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 MAD is taken over only the elements that fill the window.
If
A
is a vector, thenmovmad
operates along the length of the vectorA
.If
A
is a multidimensional array, thenmovmad
operates along the first dimension ofA
whose size does not equal 1.
M = movmad(___,
specifies the
dimension of dim
)A
to operate along for any of the previous syntaxes.
For example, movmad(A,k,2)
for a matrix A
operates across the columns of A
, computing the
k
-element sliding MAD for each row.
M = movmad(___,
specifies
whether to include or omit nanflag
)NaN
values in A
.
For example, movmad(A,k,"omitnan")
ignores NaN
values when computing each MAD. By default, movmad
includes
NaN
values.
M = movmad(___,
specifies
additional parameters for the moving MAD using one or more name-value arguments. For
example, if Name,Value
)x
is a vector of time values, then
movmad(A,k,"SamplePoints",x)
computes the moving MAD of
A
relative to the times in x
.