%% 50 Hz Sawtooth Wave
% 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;
t = 0:1/fs:T-1/fs;

x = sawtooth(2*pi*50*t);

plot(t,x)
grid on

%
% Plot the power spectrum of the wave.

pspectrum(x,fs,'Leakage',0.91)

% Copyright 2015 The MathWorks, Inc.