Table Of Contents

Histogram (Single-Shot) (G Dataflow)

Last Modified: August 6, 2018

Finds the discrete histogram of a signal.

connector_pane_image
datatype_icon

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

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: 10

datatype_icon

maximum

Maximum value to include in the histogram.

Default: 0

datatype_icon

minimum

Minimum value to include in the histogram.

Default: 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

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

datatype_icon

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.

Δ 0 = [ min , min + Δ x )
Δ 1 = [ min + Δ x , min + 2 Δ x )
Δ i = [ min + i Δ x , min + ( i + 1 ) Δ x )
Δ k 1 = [ min + ( k 1 ) Δ x , max ]

where

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

Δ 0 = [ min , min + Δ x ]
Δ 1 = ( min + Δ x , min + 2 Δ x ]
Δ i = ( min + i Δ x , min + ( i + 1 ) Δ x ]
Δ k 1 = ( min + ( k 1 ) Δ x , max ]

where

  • Δ x = max min m
  • max is the maximum
  • min is the minimum
  • m is the number of bins

Default: lower

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

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

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

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

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 )

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: DAQExpress does not support FPGA devices

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


Recently Viewed Topics