Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

State-level estimation for bilevel rectangular waveform

The `dsp.StateLevels`

object estimates the state levels of
a bilevel rectangular waveform.

To estimate the state levels of a bilevel waveform:

Create the

`dsp.StateLevels`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

`sl = dsp.StateLevels`

`sl = dsp.StateLevels(Name,Value)`

creates a state-level
estimation System
object™, `sl`

= dsp.StateLevels`sl`

, that estimates state levels in a bilevel
rectangular waveform using the histogram method with 100 bins.

returns a `sl`

= dsp.StateLevels(`Name,Value`

)`StateLevels`

System
object, `sl`

, with each specified property set to the specified
value.

**For versions earlier than R2016b, use the step
function to run the System object algorithm. The arguments to
step are the object you created, followed by
the arguments shown in this section.**

**For example, y = step(obj,x) and y = obj(x) perform equivalent operations.**

`levels = sl(x)`

`[levels,histogram] = sl(x)`

To use an object function, specify the
System
object as the first input argument. For
example, to release system resources of a System
object named `obj`

, use
this syntax:

release(obj)

The `dsp.StateLevels`

System
object uses the histogram method to estimate the states of a bilevel waveform. The
histogram method is described in [1]. To summarize the method:

Determine the maximum and minimum amplitudes and amplitude range of the data.

For the specified number of histogram bins, determine the bin width as the ratio of the amplitude range to the number of bins.

Sort the data values into the histogram bins.

Identify the lowest-indexed histogram bin,

*i*, and highest-indexed histogram bin,_{low}*i*, with nonzero counts._{high}Divide the histogram into two subhistograms. The lower-histogram bins are

*i*≤_{low}*i*≤ 1/2(*i*—_{high}*i*)._{low}The upper-histogram bins are

*i*+ 1/2(_{low}*i*–_{high}*i*) ≤_{low}*i*≤*i*._{high}Compute the state levels by determining the mode or mean of the lower and upper histograms.

[1] *IEEE ^{®} Standard on Transitions, Pulses, and Related Waveforms*, IEEE
Standard 181, 2003, pp. 15–17.