Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Moving variance

The `dsp.MovingVariance`

System
object™ computes the moving variance of the input signal along each channel,
independently over time. The object uses either the sliding window method or the exponential
weighting method to compute the moving variance. In the sliding window method, a window of
specified length is moved over the data, sample by sample, and the variance is computed over
the data in the window. In the exponential weighting method, the object subtracts each sample
of the data from the average, squares the difference, and multiplies the squared result with a
weighting factor. The object then computes the variance by adding all the weighted data. For
more details on these methods, see Algorithms.

To compute the moving variance of the input:

Create the

`dsp.MovingVariance`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

`MovVar = dsp.MovingVariance`

`MovVar = dsp.MovingVariance(Len)`

`MovVar = dsp.MovingVariance(Name,Value)`

returns a moving
variance object, `MovVar`

= dsp.MovingVariance`MovVar`

, using the default
properties.

sets the `MovVar`

= dsp.MovingVariance(`Len`

)`WindowLength`

property to `Len`

.

specifies additional properties using `MovVar`

= dsp.MovingVariance(`Name,Value`

)`Name,Value`

pairs. Unspecified
properties have default values.

```
MovVar = dsp.MovingVariance('Method','Exponential
weighting','ForgettingFactor',0.9);
```

`y = movVar(x)`

To use an object function, specify the
System
object as the first input argument. For
example, to release system resources of a System
object named `obj`

, use
this syntax:

release(obj)

[1] Bodenham, Dean. “Adaptive Filtering and Change Detection for Streaming Data.” PH.D. Thesis. Imperial College, London, 2012.

`dsp.MedianFilter`

|`dsp.MovingAverage`

|`dsp.MovingMaximum`

|`dsp.MovingMinimum`

|`dsp.MovingRMS`

|`dsp.MovingStandardDeviation`

|`dsp.Variance`