sawtooth

Generate a sawtooth wave with range [-1,1] and period 2*pi.

Syntax

s = sawtooth(t)

s = sawtooth(t, width)

Inputs

t
The times at which to generate the signal.
Dimension: vector
width
The fraction of the period for which the signal is increasing from -1 to 1 (default: 1). The signal increases on [0, 2*pi*width], and decreases from 1 to -1 on [2*pi*width, 2*pi].
Dimension: scalar

Outputs

s
The sawtooth wave.

Example

Generate five periods of a sawtooth wave that has symmetrical teeth.

t = [0:0.01:5]*(2*pi);
s = sawtooth(t, 0.5);
plot (t, s);
xlabel('time');
ylabel('amplitude');


Figure 1. sawtooth figure 1

Comments