Engee documentation

statelevels

Evaluation of the state of a two-level signal using the histogram method.

Library

EngeeDSP

Syntax

Function call

  • levels = statelevels(x) — evaluates the levels of the lower and upper states in a two-level signal x using the histogram method. For more information, see Algorithms.

  • levels = statelevels(x,nbins) — defines the number of columns in the histogram as a positive scalar value.

  • levels = statelevels(x,nbins,method) — evaluates the state levels using the average value or the mode of the sub-histograms.

  • levels = statelevels(x,nbins,method,bounds) — defines the lower and upper bounds of the histogram in a two-element real vector row bounds. Function statelevels ignores any values. x which lie outside these boundaries when calculating the histogram.

  • statelevels(___) — Displays the signal graph and the corresponding histogram.

Arguments

Input arguments

# x is a two— level signal

+ the real vector

Details

A two-level signal defined as a real vector.

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

# bounds — lower and upper bounds of the histogram

+ A two-element real vector is a string

Details

The lower and upper bounds of the histogram, defined as a two-element real vector string. Function statelevels ignores any values. x going beyond these limits when calculating the histogram.

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.

# histogram — the number of histogram elements

+ column vector

Details

The number of histogram elements returned as a column vector with nbins elements containing the number of data values in each column of the histogram.

# binlevels — the centers of the histogram columns

+ column vector

Details

The column centers of the histogram, returned as a column vector. Column vectors contain column centers for the number of histogram elements in histogram.

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:

  1. Determine the maximum and minimum amplitudes, as well as the range of data amplitudes.

  2. For a given number of histogram columns, determine the column width, which is the ratio of the amplitude range to the number of columns.

  3. Sort data values by histogram columns.

  4. Determine the column of the histogram with the lowest index and the column of the histogram with the largest index with non-zero values.

  5. Divide the histogram into two sub-histograms:

    Indexes of the lower columns of the histogram: .

    Indexes of the upper columns of the histogram: .

  6. Calculate the state levels by determining the mode or the average of the lower and upper histograms.

Literature

  1. IEEE® Standard on Transitions, Pulses, and Related Waveforms, IEEE Standard 181, 2003, pp. 15–17.