Note: This page has been translated by MathWorks. Please click here

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

To view all translated materials including this page, select Japan 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.

The object accepts multichannel inputs, that is, *m*-by-*n* size
inputs, where *m* ≥ 1, and *n* >
1. The object also accepts variable-size inputs. Once the object is
locked, you can change the size of each input channel. However, the
number of channels cannot change. This object supports C and C++ code
generation.

To compute the moving variance of the input:

Create a

`dsp.MovingVariance`

object and set the properties of the object.Call

`step`

to compute the moving variance.

Alternatively, instead of using the `step`

method
to perform the operation defined by the System
object, you can
call the object with arguments, as if it were a function. For example, ```
y
= step(obj,x)
```

and `y = obj(x)`

perform
equivalent operations.

`MovVar = dsp.MovingVariance`

returns a moving
variance object, `MovVar`

, using the default properties.

`MovVar = dsp.MovingVariance(Len)`

sets the `WindowLength`

property
to `Len`

.

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

specifies
additional properties using `Name,Value`

pairs. Unspecified
properties have default values.

**Example**:

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

reset | Reset internal states of System object |

step | Moving Variance of input signal |

Common to All System Objects | |
---|---|

`clone` | Create System object with same property values |

`getNumInputs` | Expected number of inputs to a System object |

`getNumOutputs` | Expected number of outputs of a System object |

`isLocked` | Check locked states of a System object (logical) |

`release` | Allow System object property value changes |

[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`

Was this topic helpful?