# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# 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.

 Note:   Starting in R2016b, 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.

## 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\left(v\right)=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`

## Methods

 clone Create histogram 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 histogram bin values to zero step Histogram for input data

## Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent `step` syntax. For example, myObject(x) becomes step(myObject,x).

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

```myhistogram = dsp.Histogram(1,4,4); y = step(myhistogram, [1 2 2 3 3 3 4 4 4 4]'); ```

y is equal to [1; 2; 3; 4] - one ones, 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.