Histogram (Continuous) (G Dataflow)

Version:

Finds the continuous histogram of a signal.

output representation

Representation for the output.

Name Description
sample count

Represents the value of each bin as the number of samples in that bin.

percent of total

Represents the value of each bin as a percentage of the total.

Default: sample count

reset

A Boolean to determine initialization of the internal state of the node.

 True Initializes the internal states to zero. False Initializes the internal states to the final states from the previous call of this node.

This node automatically initializes the internal state to zero on the first call and runs continuously until this input is True. For a large data sequence consisting of smaller blocks, when this input is True, this node calculates the histogram of the current block only and ignores previous blocks.

Default: False

signal

The input signal.

This input supports the following data types:

• Waveform
• Array of waveforms
• 1D array of double-precision, floating-point numbers
• 2D array of double-precision, floating-point numbers

number of bins

Number of bins in the histogram.

Default: 10

maximum

Maximum value to include in the histogram.

Default: 0

minimum

Minimum value to include in the histogram.

Default: 0

error in

Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

Default: No error

inclusion

The boundary of each bin to handle.

Name Description
lower

Includes the lower boundary.

upper

Includes the upper boundary.

Determining the Bin Widths When inclusion Is lower

If inclusion is set to lower, the bin widths are determined according to the following equations.

${\mathrm{\Delta }}_{0}=\left[\mathrm{min},\text{\hspace{0.17em}}\mathrm{min}+\mathrm{\Delta }x\right)$
${\mathrm{\Delta }}_{1}=\left[\mathrm{min}+\mathrm{\Delta }x,\text{\hspace{0.17em}}\mathrm{min}+2\mathrm{\Delta }x\right)$
$⋮$
${\mathrm{\Delta }}_{i}=\left[\mathrm{min}+i\mathrm{\Delta }x,\text{\hspace{0.17em}}\mathrm{min}+\left(i+1\right)\mathrm{\Delta }x\right)$
$⋮$
${\mathrm{\Delta }}_{k-1}=\left[\mathrm{min}+\left(k-1\right)\mathrm{\Delta }x,\text{\hspace{0.17em}}\mathrm{max}\right]$

where

• $\mathrm{\Delta }x=\frac{\mathrm{max}-\mathrm{min}}{m}$
• max is the maximum
• min is the minimum
• m is the number of bins

Determining the Bin Widths When inclusion Is upper

If inclusion is set to upper, the bin widths are determined according to the following equations.

${\mathrm{\Delta }}_{0}=\left[\mathrm{min},\text{\hspace{0.17em}}\mathrm{min}+\mathrm{\Delta }x\right]$
${\mathrm{\Delta }}_{1}=\left(\mathrm{min}+\mathrm{\Delta }x,\text{\hspace{0.17em}}\mathrm{min}+2\mathrm{\Delta }x\right]$
$⋮$
${\mathrm{\Delta }}_{i}=\left(\mathrm{min}+i\mathrm{\Delta }x,\text{\hspace{0.17em}}\mathrm{min}+\left(i+1\right)\mathrm{\Delta }x\right]$
$⋮$
${\mathrm{\Delta }}_{k-1}=\left(\mathrm{min}+\left(k-1\right)\mathrm{\Delta }x,\text{\hspace{0.17em}}\mathrm{max}\right]$

where

• $\mathrm{\Delta }x=\frac{\mathrm{max}-\mathrm{min}}{m}$
• max is the maximum
• min is the minimum
• m is the number of bins

Default: lower

histogram

The histogram of the input signal.

x values

An array of the center values of the bins of the histogram.

histogram h(x)

Discrete histogram of the input signal.

actual number of bins

Actual number of bins in the histogram.

actual maximum

Actual maximum value in the histogram.

actual minimum

Actual minimum value to include in the histogram.

error out

Error information. The node produces this output according to standard error behavior.

samples outside

Information about points not falling in any bin upon successful execution of the node.

total

Total number of values in signal not falling in any bin upon successful execution.

below

Number of values in signal below the first bin on the lower boundary.

above

Number of values in signal above the last bin on the upper boundary.

Algorithm for Constructing histogram

The histogram is a frequency count of the number of times that a specified frequency bin occurs in the input sequence. The node constructs histogram as follows.

The following equation calculates the width of the frequency bin Δx.

$\mathrm{\Delta }x=\frac{\mathrm{max}-\mathrm{min}}{m}$

where max is the maximum, min is the minimum, and m is the number of bins.

The node calculates the center of each frequency bin according to the following equation.

$\mathrm{center}\left[i\right]=\mathrm{min}+0.5\mathrm{\Delta }x+i\mathrm{\Delta }x$

The node defines the range of the ith frequency bin according to the following definition.

${\mathrm{\Delta }}_{i}\in \left(\mathrm{center}\left[i\right]-0.5\mathrm{\Delta }x,\mathrm{center}\left[i\right]+0.5\mathrm{\Delta }x\right)$

for i = 0, 1, 2, ..., m - 1

The node scans the input sequence, calculates the number of samples in each frequency bin from 0 to m - 1, and returns the histogram.

The following illustration shows the waveform of an input signal.

This example configures the node using the following input values:

• maximum=6
• minimum=0
• number of bins=3
For the previous input values, the following illustration shows the output histogram for the input signal.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported