This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Sawtooth or triangle wave




sawtooth(t) generates a sawtooth wave with period 2π for the elements of time vector t. sawtooth(t) is similar to sin(t), but creates a sawtooth wave with peaks of –1 and 1 instead of a sine wave. The sawtooth wave is defined to be –1 at multiples of 2π and to increase linearly with time with a slope of 1/π at all other times.

sawtooth(t,width) generates a modified triangle wave where width, a scalar parameter between 0 and 1, determines the point between 0 and 2π at which the maximum occurs. The function increases from –1 to 1 on the interval 0 to 2π × width, then decreases linearly from 1 to –1 on the interval 2π × width to 2π. Thus a parameter of 0.5 specifies a standard triangle wave, symmetric about time instant π with peak-to-peak amplitude of 1. sawtooth(t,1) is equivalent to sawtooth(t).


collapse all

Generate 10 periods of a sawtooth wave with a fundamental frequency of 50 Hz. The sample rate is 1 kHz.

T = 10*(1/50);
Fs = 1000;
dt = 1/Fs;
t = 0:dt:T-dt;
x = sawtooth(2*pi*50*t);

grid on

Plot the power spectrum.


Introduced before R2006a

Was this topic helpful?