image thumbnail
from Continuous sawtooth and Discrete sawtooth by Nikhil Prathapani
Generation of sawtooth wave in continuous and discrete time.

saw1.m
clear all;
close all;
clc;
fs=5000;
t=-1:1/fs:5;
x1=sawtooth(2*pi*50*t);
subplot(2,1,1);
plot(t,x1);
axis([0 0.2 -1.2 1.2]);
xlabel('time');
ylabel('amplitude');
title('continuous sawtooth wave');
subplot(2,1,2);
stem(t,x1);
axis([0 0.2 -1.2 1.2]);
xlabel('number of samples');
ylabel('amplitude');
title('discrete sawtooth wave');
display(x1);

Contact us