statelevels
Evaluation of the state of a two-level signal using the histogram method.
| Library |
|
Syntax
Function call
-
levels = statelevels(x)— evaluates the levels of the lower and upper states in a two-level signalxusing the histogram method. For more information, see Algorithms.
-
statelevels(___)— Displays the signal graph and the corresponding histogram.
Arguments
Input arguments
# nbins — number of histogram columns
+
100 (default) | a positive integer
Details
The number of histogram columns, set as a positive integer.
# method — a method for assessing the level of states
+
"mode" (by default) | "mean"
Details
A method for estimating the level of states in sub-histograms, defined as "mode" or "mean". Argument method defines the statistics used to estimate the levels of the lower and upper states. See the Algorithms section.
Output arguments
# levels — levels of the lower and upper states
+
A two-element vector is a string
Details
The levels of the lower and upper states returned as a two-element vector string. The vector of state levels is estimated using the histogram method. The first element of the vector levels — the lower state level, the second is the upper state level.
Additional Info
Condition
Details
A state is a certain level that can be associated with the upper and lower bounds of the state. The states are ordered from smallest to largest. In a two—level signal, the lowest state is the lower state. The highest state is the upper state.
State level tolerances
Details
You can specify the boundaries of the lower and upper states for each state level. Define boundaries as the level of states plus or minus a scalar value that is a multiple of the difference between the upper and lower states. To set a useful tolerance range, specify a scalar value as a small number, for example or . In the general case, the area for the lower state, it is defined as
where — the level of the lower state, and — the level of the upper state. Replace the first term in the equation with to get the tolerance area for the upper state level.
Algorithms
Function statelevels uses the histogram method to evaluate the states of a two-level signal. The histogram method is described in [1]. The steps of this method are as follows:
-
Determine the maximum and minimum amplitudes, as well as the range of data amplitudes.
-
For a given number of histogram columns, determine the column width, which is the ratio of the amplitude range to the number of columns.
-
Sort data values by histogram columns.
-
Determine the column of the histogram with the lowest index and the column of the histogram with the largest index with non-zero values.
-
Divide the histogram into two sub-histograms:
Indexes of the lower columns of the histogram: .
Indexes of the upper columns of the histogram: .
-
Calculate the state levels by determining the mode or the average of the lower and upper histograms.