Histogram (Continuous) (G Dataflow)

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

Input signal.

This input accepts the following data types:

• Waveform
• 1D array of waveforms
• Double-precision, floating-point number
• 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.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

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.

This input accepts a cluster or a 1D array of clusters.

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.

This output can return a 32-bit signed integer number or a 1D array of 32-bit signed integer numbers.

This output is available only if you wire one of the following data types to signal:

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

actual maximum

Actual maximum value in the histogram.

This output can return a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

This output is available only if you wire one of the following data types to signal:

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

actual minimum

Actual minimum value to include in the histogram.

This output can return a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

This output is available only if you wire one of the following data types to signal:

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

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

samples outside

Information about points that do not fall in any bin upon successful execution of the node.

total

Total number of values in signal that do not fall 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

Web Server: Not supported in VIs that run in a web application