Table Of Contents

Histogram (Arbitrary Bins) (G Dataflow)

Last Modified: March 15, 2017

Finds the discrete histogram of a signal based on the given bin specifications.

connector_pane_image
datatype_icon

signal

The input signal.

datatype_icon

bins

Boundaries of each bin of the histogram. This input is an array of clusters where each cluster defines the range of values for a bin.

If no bin specifications are provided in bins, this node uses maximum, minimum, number of bins, and inclusion to specify a set of uniformly spaced bins.

datatype_icon

lower

Lower boundaries of the bin.

Default: 0

datatype_icon

upper

Upper boundaries of the bin.

Default: 0

datatype_icon

inclusion

Method to treat the boundaries of each bin.

Name Description
lower Includes the lower boundary.
upper Includes the upper boundary.
both Includes both boundaries.
neither Includes neither boundaries.

Default: lower

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

number of bins

Number of bins in the histogram.

Default: 10

datatype_icon

inclusion

The boundary of each bin to handle.

If bin specifications are provided in bins, this node uses the inclusion in bins instead.

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 graph

The histogram of the input signal.

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

histogram h(x)

Discrete histogram of the input signal.

datatype_icon

x values

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

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.

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.

Algorithm for Obtaining the Histogram

The node completes the following steps to obtain the histogram h(x):

  1. Establishes all the bins, which are the intervals, based on the information in bins.
  2. Defines the function yi(x).
  3. Evaluates histogram h(x).

Algorithm for Calculating the Bin Intervals

The following equation defines the bin intervals.

Δ i = ( bins [ i ] . lower : bins [ i ] . upper ) for i = 0 , 1 , 2 , ... , k 1

where

  • bins[i].lower is the value lower in the ith cluster of array bins
  • bins[i].upper is the value upper in the ith cluster of array bins
  • k is the number of elements in bins, which consists of the number of total bins

Whether the two ending points bins[i].lower and bins[i].upper of each bin are included in the bin Δ i depends on the value of inclusion in the corresponding cluster i of bins.

If bins is an empty array, this node uses the inputs maximum, minimum, and number of bins to establish the bins. Each bin width Δ x is the same and calculated with the following equation.

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

Δ x = max min m

where

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

Algorithm for Defining the Function yi(x)

The following equation defines the function yi(x).

y i ( x ) = { 1 if x Δ i 0 elsewhere

Algorithm for Evaluating the Histogram

This node evaluates the histogram h(x) with the following equation.

h i = j = 0 n 1 y i ( x j )

where

  • n is the number of elements in the input signal
  • hi is the total number of points in the input signal that fall into the bin Δ i
  • i = 0, 1, ..., k - 1
  • k is number of bins

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices


Recently Viewed Topics