%Synthesis of a Pulse Train by Phumzile Malindi 
 
t = -1:0.05:1; 
fs = 1;
A = 1;
w = 2*pi*fs*t;
f1 = 2*A/(pi)*sin(w);
f2 = 2*A/(3*pi)*sin(3*w);
f3 = 2*A/(5*pi)*sin(5*w);
f4 = 2*A/(7*pi)*sin(7*w);
f5 = 2*A/(9*pi)*sin(9*w);
f6 = 2*A/(11*pi)*sin(11*w)
 
y = A/2 + f1 + f2 + f3 + f4 + f5 + f6; %Summing the sine waves

clf		%Clearing any figures in preparation for plotting

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