Moving variance

`M = movvar(A,k)`

`M = movvar(A,[kb kf])`

`M = movvar(___,w)`

`M = movvar(___,w,dim)`

`M = movvar(___,nanflag)`

`M = movvar(___,Name,Value)`

`M = movvar(`

returns
an array of local `A`

,`k`

)`k`

-point variance values, where each variance 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 variance is taken over only the
elements that fill the window. `M`

is the same size
as `A`

.

If

`A`

is a vector, then`movvar`

operates along the length of the vector.If

`A`

is a multidimensional array, then`movvar`

operates along the first array dimension whose size does not equal 1.

`M = movvar(___,`

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 = movvar(___,`

returns
the array of sliding variances along dimension `w`

,`dim`

)`dim`

for
any of the previous syntaxes. Always specify the weight `w`

from
the previous syntax when specifying `dim`

. For example,
if `A`

is a matrix, then `movvar(A,k,0,2)`

operates
along the columns of `A`

, computing the `k`

-element
sliding variance for each row. The normalization factor is the default, `k-1`

.

`M = movvar(___,`

specifies
whether to include or omit `nanflag`

)`NaN`

values from the
calculation for any of the previous syntaxes. `movvar(A,k,'includenan')`

includes
all `NaN`

values in the calculation while `movvar(A,k,'omitnan')`

ignores
them and computes the variance over fewer points.

`M = movvar(___,`

specifies
additional parameters for the variance using one or more name-value
pair arguments. For example, if `Name,Value`

)`x`

is a vector of
time values, then `movvar(A,k,'SamplePoints',x)`

computes
the moving variance relative to the times in `x`

.