DSP Blockset    
Histogram

Generate the histogram of an input or sequence of inputs.

Library

Statistics

Description

The Histogram block computes the frequency distribution of the elements in each column of the input, or tracks the frequency distribution in a sequence of inputs over a period of time. The Running histogram parameter selects between basic operation and running operation, described below.

The block sorts the elements of each column into the number of discrete bins specified by the Number of bins parameter, n.

Complex inputs are sorted by their magnitudes.

The histogram value for a given bin represents the frequency of occurrence of the input values bracketed by that bin. The upper-boundary of the highest-valued bin is specified by the Maximum value of input parameter, BM, and the lower-boundary of the lowest-valued bin is specified by the Minimum value of input parameter, Bm. The bins have equal width of

and centers located at

Input values that fall on the border between two bins are sorted into the lower-valued bin; that is, each bin includes its upper boundary. For example, a bin of width 4 centered on the value 5 contains the input value 7, but not the input value 3. Input values greater than the Maximum value of input parameter or less than Minimum value of input parameter are sorted into the highest-valued or lowest-valued bin, respectively.

Basic Operation

When the Running histogram check box is not selected, the block computes the frequency distribution of each column in the M-by-N input u independently at each sample time.

For convenience, length-M 1-D vector inputs and sample-based length-M row vector inputs are both treated as M-by-1 column vectors.

The output, y, is a sample-based n-by-N matrix whose jth column is the histogram for the data in the jth column of u. When the Normalized check box is selected, the block scales each column of the output so that sum(y(:,j)) is 1.

Running Operation

When the Running histogram check box is selected, the block computes the frequency distributions in a time-sequence of M-by-N inputs by creating N persistent histograms to which successive inputs are continuously added. For frame-based inputs, this is equivalent to a persistent histogram for each independent channel.

As in basic operation, length-M 1-D vector inputs and sample-based length-M row vector inputs are both treated as M-by-1 column vectors.

The output is a sample-based n-by-N matrix whose jth column reflects the current state of the jth histogram. The block resets the running histogram (by emptying all bins of all histograms) when the scalar input at the optional Rst port is nonzero. (The Rst port can be disabled by deselecting the Reset port check box.)

Example

The model below illustrates the Histogram block's basic operation for a single-channel input, u, where

The parameter settings for the Histogram block are:

The resulting bin width is 4, as shown below.

Dialog Box

Minimum value of input
The lower boundary, Bm, of the lowest-valued bin.
Maximum value of input
The upper boundary, BM, of the highest-valued bin.
Number of bins
The number of bins, n, in the histogram.
Normalized
Normalizes the output vector (1-norm) when selected. Tunable, except in Simulink's external mode.
Running histogram
Enables running operation when selected.
Reset port
Enables the Rst input port when selected.

See Also

Sort
DSP Blockset
hist
MATLAB


 From Wave File IDCT