dsp.Histogram System object

Package: dsp

Histogram of input or sequence of inputs

Description

The Histogram object generates a histogram for an input or a sequence of inputs.

To generate a histogram for an input or a sequence of inputs:

  1. Define and set up your histogram object. See Construction.

  2. Call step to generate the histogram for an input according to the properties of dsp.Histogram. The behavior of step is specific to each object in the toolbox.

Construction

H = dsp.Histogram returns a histogram object, H, that computes the frequency distribution of the elements in each input matrix.

H = dsp.Histogram('PropertyName',PropertyValue, ...) returns a histogram object, H, with each specified property set to the specified value.

H = dsp.Histogram(MIN,MAX,NUMBINS,'PropertyName',PropertyValue,...) returns a histogram object, H, with the LowerLimit property set to MIN, UpperLimit property set to MAX, NumBins property set to NUMBINS and other specified properties set to the specified values.

Properties

LowerLimit

Lower boundary

Specify the lower boundary of the lowest-valued bin as a real-valued scalar. NaN and Inf are not valid values for this property. The default is 0. This property is tunable.

UpperLimit

Upper boundary

Specify the upper boundary of the highest-valued bin as a real-valued scalar. NaN and Inf are not valid values for this property. The default is 10. This property is tunable.

NumBins

Number of bins in histogram

Specify the number of bins in the histogram. The default is 11.

Dimension

Specify how the histogram calculation is performed over the data as one of | All | Column |. The default is Column.

Normalize

Enable output vector normalization

Specify whether the histogram object normalizes the output vector, v, so that sum(v)=1. When you set this property to true, the output vector is normalized. When you set it to false, the object supports fixed-point operations and does not use this property for normalization. The default is false.

RunningHistogram

Enable calculation over successive step method calls

Set this property to true to enable running histogram calculations for the input elements over successive calls to the step method. Set this property to false to compute a histogram for the current input. The default is false.

ResetInputPort

Enable resetting in running histogram mode

Set this property to true to enable resetting the running histogram. When you set the property to true, specify a reset input to the step method that resets the running histogram. This property applies when you set the RunningHistogram property to true. When this property is false, the histogram object does not reset. The default is false.

ResetCondition

Reset condition for running histogram mode

Specify the event that resets the running histogram as one of | Rising edge | Falling edge | Either edge | Non-zero |. This property applies when you set the ResetInputPort property to true. The default is Non-zero

 Fixed-Point Properties

Methods

cloneCreate histogram object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset histogram bin values to zero
stepHistogram for input data

Examples

Compute a histogram with four bins, for possible input values 1 through 4:

 hhist = dsp.Histogram(1,4,4);
 y = step(hhist, [1 2 2 3 3 3 4 4 4 4]');
 % y equals [1; 2; 3; 4] - one one, two twos, etc.

Algorithms

This object implements the algorithm, inputs, and outputs described on the Histogram block reference page. The object properties correspond to the block parameters, except:

  • The Reset port block parameter corresponds to both the ResetCondition and the ResetInputPort object properties.

  • The Find histogram over block parameter corresponds to the Dimension property of the object.

Was this topic helpful?