Bilevel waveform pulse width
W = pulsewidth(X)
W = pulsewidth(X,FS)
W = pulsewidth(X,T)
[W,INITCROSS]
= pulsewidth(...)
[W,INITCROSS,FINALCROSS]
= pulsewidth(...)
[W,INITCROSS,FINALCROSS,MIDLEV]
= pulsewidth(...)
W = pulsewidth(...,Name,Value)
pulsewidth(...)
returns a vector, W
= pulsewidth(X
)W
, containing the time differences
between the midreference level instants of the initial and final
transitions of each positivepolarity pulse in the bilevel waveform, X
.
To determine the transitions, pulsewidth
estimates
the low and highstate levels of X
by a histogram
method. pulsewidth
identifies all regions that
cross the upperstate boundary of the low state and the lowerstate
boundary of the high state. The lowstate and highstate boundaries
are expressed as the state level plus or minus a multiple of the difference
between the state levels. See StateLevel Tolerances. Because pulsewidth
uses
interpolation to determine the midreference level instants, W
may
contain values that do not correspond to sampling instants of the
bilevel waveform, X
.
specifies
the sample rate, W
= pulsewidth(X
,FS
)FS
, in hertz as a positive scalar.
The first sample in the waveform corresponds to t=0.
Because pulsewidth
uses interpolation to determine
the midreference level instants, W
may contain
values that do not correspond to sampling instants of the bilevel
waveform, X
.
specifies
the sample instants, W
= pulsewidth(X
,T
)T
, as a vector with the
same number of elements as X
. Because pulsewidth
uses
interpolation to determine the midreference level instants, W
may
contain values that do not correspond to sampling instants of the
bilevel waveform, X
.
[
returns a column vector, W
,INITCROSS
]
= pulsewidth(...)INITCROSS
,
whose elements correspond to the midreference level instants of the
initial transition of each pulse.
[
returns a column vector, W
,INITCROSS
,FINALCROSS
]
= pulsewidth(...)FINALCROSS
,
whose elements correspond to the midreference level instants of the
final transition of each pulse.
[
returns the waveform value, W
,INITCROSS
,FINALCROSS
,MIDLEV
]
= pulsewidth(...)MIDLEV
,
which corresponds to the midreference level.
returns
the pulse widths with additional options specified by one or more W
= pulsewidth(...,Name,Value
)Name,Value
pair
arguments.
pulsewidth(...)
plots the signal and darkens
the regions of each pulse where pulse width is computed. It marks
the location of the mid crossings, and their associated reference
level. The state levels and their associated lower and upper boundaries
(adjustable by the Name,Value
pair with name 'Tolerance'
)
are also plotted.

Bilevel waveform. 

Sample rate in hertz. 

Vector of sample instants. The length of 

Midreference level as percentage of the waveform amplitude. See MidReference Level. Default: 

Pulse polarity. Specify the polarity as Default: 

Low and highstate levels. 

Tolerance levels (lower and upper state boundaries) expressed as a percentage. See StateLevel Tolerances. Default: 

Pulse widths in seconds. The pulse width is the time difference between the initial and final transitions of a pulse. The times of the initial and final transitions are referred to as transition occurrence instants in [1]. 

Midreference level instants of the initial transition 

Midreference level instants of the final transition 

Waveform value corresponding to the midreference level 
The midreference level in a bilevel waveform with lowstate level, S_1, and high state level, S_2, is
$${S}_{1}+\frac{1}{2}({S}_{2}{S}_{1})$$
Let y_{50%} denote the midreference level.
Let t_{50%} and t_{50%+} denote the two consecutive sampling instants corresponding to the waveform values nearest in value to y_{50%}.
Let y_{50%} and y_{50%+} denote the waveform values at t_{50%} and t_{50%+}.
The midreference level instant is
If the pulse has a positivegoing initial transition, the pulse has positive polarity. The following figure shows a positivepolarity pulse.
Equivalently, a positivepolarity (positivegoing) pulse has a terminating state more positive than the originating state.
If the pulse has a negativegoing initial transition, the pulse has negative polarity. The following figure shows a negativepolarity pulse.
Equivalently, a negativepolarity (negativegoing) pulse has a originating state more positive than the terminating state.
Each state level can have an associated lower and upperstate boundary. 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 red dashed lines indicate the estimated state levels.
[1] IEEE^{®} Standard on Transitions, Pulses, and Related Waveforms, IEEE Standard 181, 2003.