Period of bilevel pulse
difference between the mid-reference level instants of the initial transition of each
positive-polarity pulse and the next positive-going transition in the bilevel waveform
p = pulseperiod(
x. To determine the transitions for each pulse, the
pulseperiod function estimates the state levels of the input waveform by a
histogram method and identifies all regions which cross the upper-state boundary of the low
state and the lower-state boundary of the high state.
pulseperiod(___) plots the signal and darkens every other
identified pulse. 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
Pulse Period of Bilevel Waveform
Compute the pulse period of a bilevel waveform with two positive-polarity transitions. The sample rate is 4 MHz.
load('pulseex.mat','x','t') p = pulseperiod(x,t)
p = 5.0030e-06
Annotate the pulse period on a plot of the waveform.
Mid-Reference Level Instants of Pulse Period
Determine the mid-reference level instants that define the pulse period for a bilevel waveform.
load('pulseex.mat','x','t') [~,initcross,~,nextcross] = pulseperiod(x,t)
initcross = 3.1240e-06
nextcross = 8.1270e-06
Output the pulse period. Mark the mid-reference level instants on a plot of the data.
ans = 5.0030e-06
x — Bilevel waveform
Bilevel waveform, specified as a real-valued vector. If
x does not
contain at least two transitions, the function outputs an empty matrix. The first sample
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 = pulseperiod(x,Fs,StateLevels=[0 5])
Before R2021a, use commas to separate each name and value, and enclose
Name in quotes.
p = pulseperiod(x,Fs,'StateLevels',[0 5])
MidPercentReferenceLevel — Mid-reference level
50 (default) | scalar
Mid-reference level as a percentage of the waveform amplitude, specified as a 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 whose initial transition is positive-going (positive polarity). If you
"negative", the function looks for pulses whose initial transition
is negative-going (negative polarity). 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.
p — Pulse period
Pulse period in seconds, returned as a vector. The pulse period is
defined as the time between the mid-reference level instants of two consecutive transitions.
If the function does not find two positive-polarity transitions,
p is empty.
pulseperiod uses interpolation to determine the
mid-reference level instants,
p 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 first pulse 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 initial transition of a pulse is positive-going, 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 initial transition of a pulse is negative-going, 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.
 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