Single-Shot

Finds the discrete histogram of a signal.

1378

Inputs/Outputs

datatype_icon

output representation

Representation for the output.

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 value: sample count

datatype_icon

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
datatype_icon

number of bins

Number of bins in the histogram.

Default value: 10

datatype_icon

maximum

Maximum value to include in the histogram.

Default value: 0

datatype_icon

minimum

Minimum value to include in the histogram.

Default value: 0

datatype_icon

error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Default value: No error

datatype_icon

inclusion

The boundary of each bin to handle.

lower

Includes the lower boundary.

upper

Includes the upper boundary.

Default value: lower

Determining the Bin Widths When inclusion Is lower

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

where

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

where

  • max is the maximum
  • min is the minimum
  • m is the number of bins
datatype_icon

histogram

The histogram of the input signal.

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

datatype_icon

x values

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

datatype_icon

histogram h(x)

Discrete histogram of the input signal.

datatype_icon

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.

datatype_icon

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.

datatype_icon

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.

datatype_icon

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

datatype_icon

samples outside

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

datatype_icon

total

Total number of values in signal that do not fall in any bin upon successful execution.

datatype_icon

below

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

datatype_icon

above

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

Examples

The following illustration shows the waveform of an input signal.

1378

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

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.

Δ x = max min m Δ x = max 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.

center [ i ] = min + 0.5 Δ x + i Δ x center [ i ] = min + 0.5 Δ x + i Δ x

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

Δ i ( center [ i ] 0.5 Δ x , center [ i ] + 0.5 Δ x ) Δ i ( center [ i ] 0.5 Δ x , center [ i ] + 0.5 Δ x )

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.