Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Slew Rate of Triangular Waveform

This example shows how to use the slew rate as an estimate of the rising and falling slopes of a triangular waveform. Create three triangular waveforms. One waveform has rising-falling slopes of $\pm2$, one waveform has rising-falling slopes of $\pm{1\over2}$, and one waveform has a rising slope of $+2$ and a falling slope of $-{1\over2}$. Use slewrate to find the slopes of the waveforms.

Use tripuls to create a triangular waveform with rising-falling slopes of $\pm2$. Set the sampling interval to 0.01 seconds, which corresponds to a sample rate of 100 hertz.

dt = 0.01;
t = -2:dt:2;

x = tripuls(t);

Compute and plot the slew rate for the triangular waveform. Input the sample rate (100 Hz) to obtain the correct positive and negative slope values.

slewrate(x,1/dt)
ans =

    2.0000   -2.0000

Change the width of the triangular waveform so it has slopes of $\pm{1\over2}$. Compute and plot the slew rate.

x = tripuls(t,4);
slewrate(x,1/dt)
ans =

    0.5000   -0.5000

Create a triangular waveform with a rising slope of $+2$ and a falling slope of $-{1\over2}$. Compute the slew rate.

x = tripuls(t,5/2,-3/5);
s = slewrate(x,1/dt)
s =

    2.0000   -0.5000

The first element of s is the rising slope and the second element is the falling slope. Plot the result.

slewrate(x,1/dt);

Was this topic helpful?