![]() |
X must contain at least one sample. If X is empty, the histogram is undefined, and the VI sets Histogram: h(x) and X Values to empty arrays and returns an error. |
![]() |
intervals must be greater than zero. If intervals is less than or equal to zero, the histogram is undefined, and the VI sets Histogram: h(X) and X Values to empty arrays and returns an error. The default is 1. |
![]() |
Histogram: h(x) is the discrete histogram of the input sequence X. |
![]() |
X Values is the center values of the intervals (bins) of the histogram. |
![]() |
error returns any error or warning condition from the VI. |
The histogram is a frequency count of the number of times that a specified interval occurs in the input sequence. The width of the frequency bin is
delta_x = (max - min) / m
where m is the requested number of bins. The centers of each bin are set according to the following equation:
center[i] = min + delta_x/2 + i * delta_x.
Example
If the input sequence is
X = {0, 1, 3, 3, 4, 4, 4, 5, 5, 8}
then the Histogram: h(x) of X for eight intervals is
Notice that the histogram of the input sequence X is a function of X.
The VI obtains Histogram: h(x) as follows. The VI scans the input sequence X to determine the range of values in it. Then the VI establishes the interval width, x, according to the specified number of intervals,
where max is the maximum value found in the input sequence X, min is the minimum value found in the input sequence X, and m is the specified number of intervals.
Let represent the output sequence X Values, because the histogram is a function of X. The VI evaluates elements of c using
The VI defines the interval to be the range of values from up to but not including,
and defines the function to be
The function has unity value if the value of x falls within the specified interval. Otherwise it is zero. Notice that the interval is centered about
, and its width is
.
The last interval, , is defined. In other words, if a value is equal to max, it is counted as belonging to the last interval.
Finally, the VI evaluates the histogram sequence H using
where represents the elements of the output sequence Histogram: h(x), and n is the number of elements in the input sequence X.