Documentation |
Package: dsp
Variance of input or sequence of inputs
The Variance object computes variance for an input or sequence of inputs.
To compute the variance of an input or sequence of inputs:
Define and set up your variance System object™. See Construction.
Call step to compute the variance according to the properties of dsp.Variance. The behavior of step is specific to each object in the toolbox.
H = dsp.Variance returns a variance System object, H, that computes the variance of an input or a sequence of inputs over the specified Dimension.
H = dsp.Variance('PropertyName',PropertyValue,...) returns a variance System object, H, with each specified property set to the specified value.
RunningVariance |
Enable calculation over time Set this property to true to enable variance calculation over successive calls to the step method. The default is false. |
ResetInputPort |
Enable reset input port Set this property to true to enable reset input port. When you set the property to true, specify a reset input for the step method. The running variance resets anytime the variance object achieves the condition you specify for the ResetCondition property. This property applies when you set the RunningVariance property to true. The default is false. |
ResetCondition |
Reset condition for running variance mode Specify which event resets the running variance as one of | Rising edge | Falling edge | Either edge | Non-zero |. This property applies when you set the ResetInputPort property to true. |
Dimension |
Dimension to operate along Specify how the object performs the variance calculation over the data as one of | All | Row | Column | Custom |. This property applies when you set the RunningVariance property to false. The default is Column. |
CustomDimension |
Numerical dimension to operate along Specify the input signal dimension (one-based value) the object uses to compute variance. The cannot exceed the number of dimensions in the input signal. This property applies when you set the Dimension property to Custom. The default is 1. |
ROIProcessing |
Enable region-of-interest processing Set this property to true to enable calculating the variance within a particular region of each image. This property applies when you set the RunningVariance property to false and the Dimension property to All. The default is false. Full ROI processing support requires a Computer Vision System Toolbox™ license. With only the DSP System Toolbox™ license, Rectangles is the only selection for the ROIForm property. |
ROIForm |
Define the type of region of interest. Specify the type of region of interest as one of | Rectangles | Lines | Label matrix | Binary mask |. This property applies when you set the ROIProcessing property to true. The default is Rectangle. |
ROIPortion |
Calculate over entire ROI or just perimeter Specify the region over which to calculate variance as one of | Entire ROI | ROI perimeter |. This property applies when you set the ROIForm property to Rectangles. The default is Entire ROI. |
ROIStatistics |
Statistics for each ROI or one for all ROIs Specify if statistics calculations are one of | Individual statistics for each ROI | Single statistic for all ROIs |. This property applies when ROIForm property is not Binary mask. The default is Individual statistics for each ROI. |
ValidityOutputPort |
Enable output of validity check of ROI or label numbers Indicate whether to return the validity of the specified ROI being completely inside image when the ROIForm property is Lines or Rectangles. Indicate whether to return the validity of the specified label numbers when the ROIForm property is Label Matrix. This property applies when you set the ROIForm property to anything except Binary Mask. The default is false. |
FrameBasedProcessing |
Enable frame-based processing Set this property to true to enable frame-based processing. Set this property to false to enable sample-based processing. This property applies when you set the RunningVariance property to true. The default is true. |
clone | Create variance object with same property values |
getNumInputs | Number of expected inputs to step method |
getNumOutputs | Number of outputs of step method |
isLocked | Locked status for input attributes and nontunable properties |
release | Allow property value and input characteristics changes |
reset | Reset variance to zero |
step | Variance of input |
Compute the running variance for a signal:
hvar = dsp.Variance; hvar.RunningVariance = true; x = randn(100,1); y = step(hvar, x); % y(i) is the running variance of all values in the vector x(1:i)
This object implements the algorithm, inputs, and outputs described on the Variance block reference page. The object properties correspond to the block parameters, except:
Treat sample-based row input as a column block parameter is not supported by the dsp.Variance object.
Reset port block parameter corresponds to both the ResetCondition and the ResetInputPort object properties.
Both this object and its corresponding block let you specify whether to process inputs as individual samples or as frames of data. The object uses the FrameBasedProcessing property. The block uses the Input processing parameter. See Set the FrameBasedProcessing Property of a System object for more information.