%Synthesis of a Sawtooth Waveform by Phumzile Malindi 
 
t = -1:0.05:1; 
fs = 1;
A = 1;
w = 2*pi*fs*t;
f1 = A*sin(w);
f2 = -A/2*sin(2*w);
f3 = A/3*sin(3*w);
f4 = -A/4*sin(4*w);
f5 = A/5*sin(5*w);
f6 = -A/6*sin(6*w);
f7 = A/7*sin(7*w);
f8 = -A/8*sin(8*w);
f9 = A/9*sin(9*w);
f10 = -A/10*sin(10*w);

y = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8+ f9 + f10; %Summing the sine waves

clf		%Clearing any figures in preparation for plotting

subplot(231), plot(t,f1), title('f1 = A*sin(w)'), grid;
subplot(232), plot(t,f2),title('f2 = -A/2*sin(2*w)'), grid;
subplot(233), plot(t,f3), title('f3 = A/3*sin(3*w)'), grid;
subplot(234), plot(t,f4), title('f4 = -A/4*sin(4*w)'), grid;
subplot(235), plot(t,f5), title('f5 = A/5*sin(5*w)'), grid;
subplot(236), plot(t,y), title('Synthesized Sawtooth'), grid;

 
