PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Analog and Digital Filters 655


figure(2)
subplot(2,1,1)
plot(omega,abs(Hfir1))
xlabel(‘frequency in rad’)
ylabel(‘magnitude’)
title(‘Mag./FIR using fir1’)
grid on;
subplot(2,1,2)
plot(o m e ga,u nw rap(a n gle(Hfir1)))
xlabel(‘frequency in rad’)
ylabel(‘phase’);
title(‘Phase/FIR using fir1’);grid on;
Back in the command window, the script fi le review_ FIR_LPF is executed and the results
are as follows (Figures 6.79 and 6.80):
>> review _ FIR _ LPF

Example 6.22

Create the script fi le revisit_ analog_fi lters that returns the following fi lter imp lementations:
a. A four-pole analog Butterworth and Chebyshev/type-1 normalized fi lters with a
pass-band ripple of Rp= 2 dB.
b. Transform the LPF of part (a) to an LPF with a BW of 2 rad/s using the function
lp2lp.
c. Convert the Butterworth LPF of part (a) to an HPF with a cutoff frequency of
2 rad/s.
d. Convert the Butterworth LPF of part (a) to a BPF with a center frequency at 2 rad/s
and a BW of 1 rad/s.
e. Convert the Butterworth and Chebyshev LPFs of part (a) to BSFs with a center fre-
quency at 2 rad/s and a BW of 1 rad/s (from w = 1.5 rad/s to w = 2.5 rad/s).

FIGURE 6.79
Twe n t y- fi fth-order normalized FIR/LPF using the remez algorithm of Example 6.21.

0

0

1

0.5
magnitude

1.5

0.1 0.2 0.3 0.4 0.5

Mag./FIR using remez

frequency in rad
0.6 0.7 0.8 0.9 1

0

 20

 15

 10

 5

0

phase in rad.

0.1 0.2 0.3 0.4 0.5

Phase/FIR using remez

frequency in rad
0.6 0.7 0.8 0.9 1
Free download pdf