You are here : matlabSignal Processingslewrate

slewrate() - Signal Processing

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 upper-state boundary of the low state and
the lower-state boundary of the high state. 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. See State-Level 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 lower-percent reference level, LT,
and upper-percent reference level, UT. If you
do not specify lower- and upper-percent reference levels, the levels
default to 10% and 90%.[S,LT,UT,LL,UL]
= slewrate(...) returns the waveform values that correspond
to the lower-reference levels, LL, and upper-reference
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 upper-reference level crossings
and associated reference levels. The plot indicates the state levels
and associated lower and upper tolerances.


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(...)


Example

Slew Rate For One-Transition WaveformOpen This Example
Use slewrate 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. Annotate the slew rate in a plot of the waveform.load('transitionex.mat','x','t')

slewrate(x,t)

ans =

   1.0310e+07


Slew Rates for Three-Transition WaveformOpen This Example
Create a bilevel waveform with three transitions, two positive and one negative. The sample rate is 4 MHz. Obtain the slew rates for the three transitions.
load('transitionex.mat','x')
fs = 4e6;

y = [x;fliplr(x)];
t = (0:length(y)-1)/4e6;

S = slewrate(y,t)

S =

   1.0e+07 *

    1.0310
   -0.9320
    1.0310

Annotate the result on a plot of the waveform.slewrate(y,t);

Lower and Upper Transition TimesOpen This Example
Return the lower- and upper-transition times for a three-transition waveform sampled at 4 MHz.
load('transitionex.mat','x')
fs = 4e6;

y = [x;fliplr(x)];
t = (0:length(y)-1)/fs;

[~,LT,UT] = slewrate(y,t)

LT =

   1.0e-04 *

    0.0504
    0.0998
    0.1504


UT =

   1.0e-04 *

    0.0521
    0.0978
    0.1521

Repeat using the sample rate instead of the time vector.[~,LT,UT] = slewrate(y,fs)

LT =

   1.0e-04 *

    0.0504
    0.0998
    0.1504


UT =

   1.0e-04 *

    0.0521
    0.0978
    0.1521

Annotate the result on a plot of the waveform.slewrate(y,fs);

Lower and Upper Reference LevelsOpen This ExampleReturn the waveform values corresponding to the lower- and upper-reference levels for a three-transition waveform sampled at 4 MHz. Compute these values for 10% and 90%, the default levels.load('transitionex.mat','x')
fs = 4e6;

y = [x;fliplr(x)];
t = (0:length(y)-1)/fs;

[~,~,~,LL,UL] = slewrate(y,t)

LL =

    0.2212


UL =

    2.0564

Repeat the calculation for 20% and 80%. Annotate the result on a plot of the waveformslewrate(y,t,'PercentReferenceLevels',[20 80]);


Output / Return Value


Limitations


Alternatives / See Also


Reference