Statelevel estimation for bilevel rectangular waveform
The StateLevels
object estimates the state
levels of a bilevel rectangular waveform.
To estimate the state levels of a bilevel waveform:
Define and set up your statelevel estimation. See Construction.
Call step
to estimate the state levels
for an input vector according to the properties of dsp.StateLevels
.
The behavior of step
is specific to each object in
the toolbox.
Starting in R2016b, instead of using the step
method
to perform the operation defined by the System
object™, you can
call the object with arguments, as if it were a function. For example, y
= step(obj,x)
and y = obj(x)
perform
equivalent operations.
sl = dsp.StateLevels
creates
a statelevel estimation System
object, sl
, that
estimates state levels in a bilevel rectangular waveform using the
histogram method with 100 bins.
sl = dsp.StateLevels('
returns
an PropertyName
',PropertyValue
,...)StateLevels
System
object, sl
,
with each specified property set to the specified value.

Minimum and maximum levels of the histogram. Specify the range
of the histogram as a 2element real–valued row vector. Signal
values outside the range defined by this property are ignored. This
property applies when you set the Default: 

Source of histogram bounds. Specify how to determine the histogram
bounds as one of Default: 

Number of bins in the histogram. Specify the number of bins
in the histogram. This property applies when you set the Default: 

Enable histogram output. Set this property to Default: 

Algorithm used to compute state levels. Specify the method used
to compute state levels as one of Default: 

Calculation over successive calls to 
A particular level, which can be associated with an upper and lower state boundary. States are ordered from the most negative to the most positive. In a bilevel waveform, the most negative state is the low state. The most positive state is the high state.
Each state level can have associated lower and upperstate boundaries. These state boundaries are defined as the state level plus or minus a scalar multiple of the difference between the high state and low state. To provide a useful tolerance region, the scalar is typically a small number such as 2/100 or 3/100. In general, the α% tolerance region for the low state is defined as
$${S}_{1}\pm {\scriptscriptstyle \frac{\alpha}{100}}({S}_{2}{S}_{1})$$
where S_{1} is the lowstate level and S_{2} is the highstate level. Replace the first term in the equation with S_{2} to obtain the α% tolerance region for the high state.
The following figure illustrates lower and upper 2% state boundaries (tolerance regions) for a positivepolarity bilevel waveform. The estimated state levels are indicated by a dashed red line.
plot  Plot signal, state levels, and histogram 
reset  Reset internal states of state levels object 
step  Estimate state levels for bilevel rectangular waveform 
Common to All System Objects  

clone  Create System object with same property values 
getNumInputs  Expected number of inputs to a System object 
getNumOutputs  Expected number of outputs of a System object 
isLocked  Check locked states of a System object (logical) 
release  Allow System object property value changes 
The 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 lowestindexed histogram bin, i_{low}, and highestindexed histogram bin, i_{high}, with nonzero counts.
Divide the histogram into two subhistograms. The lowerhistogram bins are i_{low} ≤ i ≤ 1/2(i_{high} — i_{low}).
The upperhistogram bins are i_{low} + 1/2(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.