Separation between bilevel waveform pulses
differences between the mid-reference level instants of the final negative-going transitions of
every positive-polarity pulse and the next positive-going transition. To determine the
transitions that compose each pulse, the
S = pulsesep(
pulsesep function estimates the
state levels of the input waveform by a histogram method. The function identifies all regions
that cross the upper-state boundary of the low state and the lower-state boundary of the high
returns the mid-reference level instants
finalcross of the final transition
of each pulse.
returns the mid-reference level instants
nextcross of the next detected
transition after each pulse.
returns the mid-reference level
returns the pulse separations with additional options specified by one or more name-value
pulsesep(___) plots the signal and darkens the regions
between each pulse where pulse separation is computed. The function marks the location of the
mid crossings and their associated reference level. The function also plots the state levels and
their associated lower and upper boundaries. You can adjust the boundaries using the
'Tolerance' name-value argument.
Pulse Separation in Bilevel Waveform
Compute the pulse separation in a bilevel waveform with two positive-polarity transitions. The sample rate is 4 MHz.
load('pulseex.mat','x','t') s = pulsesep(x,t)
s = 3.5014e-06
Plot the waveform and annotate the pulse separation.
Mid-Reference Level Instants Defining Pulse Separation
Determine the mid-reference level instants that define the pulse separation for a bilevel waveform.
load('pulseex.mat','x','t') [~,~,finalcross,nextcross] = pulsesep(x,t)
finalcross = 4.6256e-06
nextcross = 8.1270e-06
Return the pulse separation. Annotate the mid-reference level instants on a plot of the data.
ans = 3.5014e-06
x — Bilevel waveform
Bilevel waveform, specified as a real-valued vector. If the waveform does not contain at
least two transitions, the function outputs an empty matrix. The first time instant in
x corresponds to t=0.
Fs — Sample rate
positive real scalar
Sample rate, specified as a positive real scalar in hertz.
t — Sample instants
Sample instants, specified as a vector. The length of
t must equal
the length of the input bilevel waveform
Specify optional pairs of arguments as
the argument name and
Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
p = pulsesep(x,t,Polarity="negative")
Before R2021a, use commas to separate each name and value, and enclose
Name in quotes.
p = pulsesep(x,t,'Polarity',"negative")
MidPercentReferenceLevel — Mid-reference level
50 (default) | scalar
Mid-reference level as a percentage of the waveform amplitude, specified as scalar. For more information, see Mid-Reference Level.
Polarity — Pulse polarity
"positive" (default) |
Pulse polarity, specified as
"negative". If you specify
"positive", the function
looks for pulses with positive-going (positive polarity) initial transitions. If you specify
"negative", the function looks for pulses with negative-going (negative
polarity) initial transitions. For more information, see Pulse Polarity.
StateLevels — Low- and high-state levels
1-by-2 real-valued vector
Low- and high-state levels, specified as a 1-by-2 real-valued vector. The first element
is the low-state level and the second element is the high-state level. If you do not specify
'StateLevels', the function estimates the state levels from the input
waveform using the histogram method.
Tolerance — Tolerance levels
2 (default) | scalar
Tolerance levels (lower- and upper-state boundaries), specified as a scalar and expressed as a percentage. The low-state and high-state boundaries are expressed as the state level plus or minus a multiple of the difference between the state levels. For more information, see State-Level Tolerances.
s — Pulse separations
Pulse separations in seconds, returned as a vector. The pulse separation is defined as the time between the mid-reference level instants of the final transition of one pulse and the initial transition of the next pulse. For more information, see Pulse Separation.
pulsesep uses interpolation to determine the mid-reference
s may contain values that do not correspond to sampling
instants of the bilevel waveform
initcross — Mid-reference level instants of initial transition
Mid-reference level instants of the initial transition, returned as a vector.
finalcross — Mid-reference level instants of final transition
Mid-reference level instants of the final transition, returned as a vector.
nextcross — Mid-reference level instants of initial transition after final transition of preceding pulse
Mid-reference level instants of the initial transition after the final transition of the preceding pulse, returned as a vector.
midlev — Waveform value
Waveform value that corresponds to the mid-reference level, returned as a scalar.
The mid-reference level in a bilevel waveform with low-state level S1 and high-state level S2 is
Mid-Reference Level Instant
Let y50% denote the mid-reference level.
Let t50%- and t50%+ denote the two consecutive sampling instants corresponding to the waveform values nearest in value to y50%.
Let y50%- and y50%+ denote the waveform values at t50%- and t50%+.
The mid-reference level instant is
If the pulse has an initial positive-going transition, the pulse has positive polarity. This figure shows a positive-polarity pulse.
Equivalently, a positive-polarity (positive-going) pulse has a terminating state more positive than the originating state.
If the pulse has an initial negative-going transition, the pulse has negative polarity. This figure shows a negative-polarity pulse.
Equivalently, a negative-polarity (negative-going) pulse has a originating state more positive than the terminating state.
You can specify lower- and upper-state boundaries for each state level. Define the boundaries as the state level plus or minus a scalar multiple of the difference between the high state and the low state. To provide a useful tolerance region, specify the scalar as a small number such as 2/100 or 3/100. In general, the region for the low state is defined as
where is the low-state level and is the high-state level. Replace the first term in the equation with to obtain the tolerance region for the high state.
This figure shows lower and upper 5% state boundaries (tolerance regions) for a positive-polarity bilevel waveform. The thick dashed lines indicate the estimated state levels.
Pulse separation is the time difference between the mid-reference level instant of the final transition of one pulse and the mid-reference level instant of the initial transition of the next pulse. This figure illustrates pulse separation.
 IEEE® Standard on Transitions, Pulses, and Related Waveforms, IEEE Standard 181, 2003.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2012a