Finds the discrete histogram of the input sequence X based on the given bin specifications.


icon

Inputs/Outputs

  • c1ddbl.png X

    X represents the input data.

  • c1dnclst.png Bins

    Bins specifies the boundaries of each bin of the histogram.

    The input Bins is an array of clusters where each cluster defines the range of values for a bin.

  • cdbl.png lower

    lower specifies the lower boundaries of the bin.

  • cdbl.png upper

    upper specifies the upper boundaries of the bin.

  • cenum.png inclusion

    inclusion specifies how to treat the boundaries of each bin.

    If no bin specifications are provided in the input Bins, the inputs max, min, # bins, and inclusion are used to specify a set of uniformly spaced bins.

    0Lower—Lower boundary is part of the bin but not the upper boundary.
    1Upper—Upper boundary is part of the bin but not the lower boundary.
    2Both—Both boundaries are part of the bin.
    3Neither—Excludes both boundaries from the bin.
  • cdbl.png max

    max specifies the maximum value to include in the histogram. LabVIEW ignores this control if the Bins input array is not empty.

  • cdbl.png min

    min specifies the minimum value to include in the histogram. LabVIEW ignores this control if the Bins input array is not empty.

  • ci32.png # bins

    # bins specifies the number of bins in the histogram. # bins is ignored if the Bins input array is not empty.

    The default behavior is to determine the number of bins according to Sturges' Rule, number of bins = 1 + 3.3log(size of(X)).

  • cenum.png inclusion

    inclusion specifies how to handle the boundaries of each bin.

    If array Bins is not empty, LabVIEW ignores the max, min, # bins, and inclusion inputs.

    0lower—Includes the lower boundary.
    1upper—Includes the upper boundary.
  • icclst.png Histogram Graph

    Histogram Graph displays the bar graph of the histogram of the input sequence X. The y-axis is the histogram count, and the x-axis is the histogram center values of the intervals (bins) of the histogram.

  • i1di32.png Histogram

    Histogram specifies the resulting histogram.

  • i1ddbl.png Axis

    Axis specifies the center values for each bin of Histogram.

    The centers of each bin are set according to the following equation and returned in the output array Axis. center[i] = (lower + upper)/2,where lower is the lower boundary of bin i, and upper is the upper boundary of bin i.

  • inclst.png # outside

    # outside contains information about points not falling in any bin upon successful execution of the VI.

    Note The elements above and below have meaning only if you specify Bins such that Bins[0].upper ≤ Bins[1].lower < Bins[1].upper, …– < Bins[k – 1].lower, and < Bins[k – 1].upper, where k is the number of elements in Bins.
  • ii32.png total

    total contains the total number of values in X not falling in any bin upon successful execution.

  • ii32.png below

    below represents the number of values in X below the first bin on the lower boundary. The first bin on the lower boundary is Bins[0].lower.

  • ii32.png above

    above represents the number of values in X above the last bin on the upper boundary. The last bin on the upper boundary is Bins[size of(Bins) – 1].upper.

  • ii32.png error

    error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

  • The General Histogram VI completes the following steps to obtain the Histogram:

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

    Establishing the Bins

    The following equation defines the bin intervals.

    Δi = (Bins[i].lower: Bins[i].upper) 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, and 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, the General Histogram VI uses the inputs max, min, and # bins to establish the bins. Each bin width Δx is the same and calculated with the following equation.

    If the Bins array contains elements, the bin widths are determined by the inclusion subparameter of the Bins parameter.

    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]

    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]

    Note The first start point min and last end point max are always included in the first and last bins.

    Defining the Function yi(x)

    The following equation defines the function yi(x).

    For example, if x falls into the bin Δi, then yi(x) = 1.

    Evaluating the Histogram Sequence H

    The General Histogram VI evaluates the histogram sequence H with the following equation.

    where H represents the elements of the output sequence Histogram, n is the number of elements in the input sequence X, hi is the total number of points in the input array X that fall into the bin Δi, i = 0, 1, …, k – 1, and k is the number of bins.

    Examples

    Refer to the following example files included with LabVIEW.

    • labview\examples\Mathematics\Probability and Statistics\Running Histogram.vi