slewrate
Slew rate of bilevel waveform
Syntax
S = slewrate(X)
S = slewrate(X,Fs)
S = slewrate(X,T)
[S,LT,UT]
= slewrate(...)
[S,LT,UT,LL,UL]
= slewrate(...)
S = slewrate(...,Name,Value)
slewrate(...)
Description
S = slewrate(X) returns
the slew rate for all transitions found in the bilevel waveform, X.
The slew rate is the slope of the line connecting the 10% and 90%
reference levels. The sample instants of X are
the indices of the vector. To determine the transitions, slewrate estimates
the state levels of the input waveform by a histogram method. slewrate 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.
S = slewrate(X,Fs) specifies
the sample rate, Fs, in hertz. The first time
instant in X corresponds to t=0.
S = slewrate(X,T) specifies
the sample instants in the vector, T. The length
of T must equal the length of X.
[S,LT,UT]
= slewrate(...) returns the time instants when the waveform
crosses the lowerpercent reference level, LT,
and upperpercent reference level, UT. If you
do not specify lower and upperpercent reference levels, the levels
default to 10% and 90%.
[S,LT,UT,LL,UL]
= slewrate(...) returns the waveform values that correspond
to the lowerreference levels, LL, and upperreference
levels, UL.
S = slewrate(...,Name,Value) returns
the slew rate for all transitions with additional options specified
by one or more Name,Value pair arguments.
slewrate(...) plots the bilevel waveform
and darkens the regions of each transition where the slew rate is
computed. The plot marks the lower and upperreference level crossings
and associated reference levels. The plot indicates the state levels
and associated lower and upper tolerances.
X 
Bilevel waveform as a realvalued column or row vector. If the
input waveform does not have at least one transition, slewrate returns
an empty matrix.

Fs 
Sampling rate in hertz.

T 
Vector of sample instants. The length of T must
equal the length of the bilevel waveform, X.

NameValue Pair Arguments
'PercentReferenceLevels' 
Percent reference levels. See Percent Reference Levels for a definition.
Default: [10,90] 
'StateLevels' 
Low and highstate levels. StateLevels is
a 1by2 realvalued vector. The first element is the lowstate level.
The second element is the highstate level. If you do not specify
low and highstate levels, slewrate estimates
the state levels from the input waveform using the histogram method.

'Tolerance' 
Tolerance levels (lower and upper state boundaries) expressed
as a percentage. See StateLevel Tolerances.
Default: 2 
Output Arguments
S 
Slew rates as realvalued scalars. A positive slew rate indicates
that the upperpercent reference level occurs later than the lowerpercent
reference level. A negative slew rate indicates that the upperpercent
reference level occurs before the lowerpercent reference level.

LT 
Time instants when signal crosses the lower percent reference
level. If you do not specify the lower percent reference levels with
the 'PercentReferenceLevels' namevalue pair, the
lower percent reference level is 10%.

UT 
Time instants when signal crosses the upperpercent reference
level. If you do not specify the upperpercent reference levels with
the 'PercentReferenceLevels' namevalue pair, the
upperpercent reference level is 90%.

LL 
Waveform values at the lowerreference level.

UL 
Waveform values at the upperreference level.

Examples
expand all
Useslewrate with no output
arguments to plot the slew rate information for a step waveform sampled
at 4 MHz.
Load the transitionex.mat file and
compute the slew rate.
load('transitionex.mat', 'x', 't');
slewrate(x, t)
Create a threetransition (two positive and
one negative) bilevel waveform. Obtain the slew rates for the three
transitions.
load('transitionex.mat', 'x');
y = [x ; fliplr(x)];
t = 0:1/4e6:(length(y)*(1/4e6))1/4e6;
S = slewrate(y, t);
Return the lower and uppertransition times
for a threetransition waveform.
load('transitionex.mat', 'x');
y = [x ; fliplr(x)];
t = 0:1/4e6:(length(y)*(1/4e6))1/4e6;
[S,LT,UT] = slewrate(y, t);
% or [S,LT,UT] = slewrate(y,4e6);
Return the waveform values corresponding to
the lower and upperreference levels for a threetransition waveform.
Compute these values for the default 10% and 90% and for 20% and 80%.
load('transitionex.mat', 'x');
y = [x ; fliplr(x)];
t = 0:1/4e6:(length(y)*(1/4e6))1/4e6;
[~,LT_1090,UT_1090,LL_1090,UL_1090] = slewrate(y, t);
[~,LT_2080,UT_2080,LL_2080,UL_2080] = slewrate(y, t,...
'PercentReferenceLevels',[20 80]);
More About
expand all
If S_{1} is the low state, S_{2} is
the high state, and U is the upperpercent
reference level. The waveform value corresponding to the upperpercent
reference level is
If L is the lowerpercent
reference level, the waveform value corresponding to the lower percent
reference level is
The slew rate is the slope of a line connecting the upper and
lowerpercent reference levels. Let t_{L} denote
the time instant when the waveform crosses the lower reference level
and t_{U} denote the time instant
when the waveform crosses the upper percent reference level. Using
the definitions for the upper and lower percent reference levels given
in Percent Reference Levels, the
slew rate is
When t_{L} occurs earlier
than t_{U}, the slew rate is
positive. When t_{U} occurs
earlier than t_{L}, the slew
rate is negative.
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
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.
References
[1] IEEE^{®} Standard on Transitions,
Pulses, and Related Waveforms, IEEE Standard 181, 2003.
See Also
midcross  pulsewidth  settlingtime  statelevels