Analog and Digital Filters 647
MATLAB Solution
% Script file: IIR-yul
% IIR/YULE-WALKER
% for N = 4, 6, 8, and 10
f = [0:.1:1.0];
omega = 0:1/512:511/512;
mag = [1 1 1 .707 zeros(1,7)];
[num4,den4] = yulewalk(4,f,mag);
[num6,den6] = yulewalk(6,f,mag);
[num8,den8] = yulewalk(8,f,mag);
[num10,den10] = yulewalk(10,f,mag);
h4 = freqz(num4,den4);
h6 = freqz(num6,den6);
h8 = freqz(num8,den8);
h10 = freqz(num10,den10);
figure(1)
subplot(2,2,1)
plot(f,mag,’o’,omega,abs(h4))
ylabel(‘Magnitude(H)’)
title(‘Order=4’)
subplot(2,2,2)
plot(f,mag,’o’,omega,abs(h6))
ylabel(‘Magnitude(H)’)
title(‘Order=6’)
subplot(2,2,3)
plot(f,mag,’o’,omega,abs(h8))
FIGURE 6.72
Gain and phase plots of the transfer function of the fi lter of Example 6.17.
0
Gain in db
50
100
150
200
250
2.5 1.5 0.5 0.5 1.5 2.5
104
104
10
Magnitude of [H(f)] versus f
Phase of [H(f)] versus f
f in Hertz
f in Hertz
2 12
100
50
50
100
0
Angle in degrees
2.5 2 1.5 101 20.5 0.5 1.5 2.5
See Figure 6.72.