% Example 6.2

Omega = -pi:2*pi/300:pi;
X = (1-.5*cos(Omega)-j*.5*sin(Omega))./(1-2*.5*cos(Omega)+.5^2);
subplot(211),plot(Omega,abs(X));
title('Example 6.2')
xlabelg('W')  % uses Greek character in label
ylabel('|X|')

subplot(212),plot(Omega,angle(X)*180/pi);
xlabelg('W')
ylabel('Angle(X), degrees')
subplot(111)

% figures in text were plotted using 
%  plot(Omega/pi,abs(X)) and plot(Omega/pi,angle(X)*180/pi)
%  and the pi's in the axis labels were added by hand