fig4_12.m
% Produces Figure 4.12
%
% demonstrates the relationship between the 
%   Fourier Series and the Fourier Transform
%
T = input('Input T ')
w0 = 2*pi/T;
%  plot for frequencies -30 to 30
N = 30/w0;
c0 = 1/T;
n=1:N;
cn = [sin(n*pi/T)/pi./n];
w = [w0*n 0 -w0*n];
Tcn = T*abs([cn c0 cn]);
clg
subplot(211),stem(w,Tcn)
%  The plot in the text was generated using stem(w/pi,Tcn)
%     and the pi's along the x axis were added by hand.  
%     The x label was also added by hand.     
axis([-30 30 0 1.25])
title(['Figure 4.12, T = ',num2str(T)])
ylabel('T|cn|')
xlabel('Frequency (rad/sec)')
subplot(111)

Contact us at files@mathworks.com