654 Practical MATLAB® Applications for Engineers
FIGURE 6.78
Filter’s plot of part (c) of Example 6.20.
1.4 200
150
100
50
50
100
150
200
0
1.2
0.8
Magnitude
Angle in degrees
0.6
0.4
0.2
0
0 0.5
frequency W in rad
Mag. of BPF using remez/order 8 Phase of BPF using remez/order 8
1 0 0.5
frequency W in rad
1
1
For each of the fi lters obtain the magnitude and phase plots.
The solution is given by the script fi le review_ FIR_LPF as follows:
MATLAB Solution
% Script file : review _ FIR _ LPF
% Design of FIR using remez
f = linspace(0,1,10);
mag = [ones(1,3) .707 zeros(1,6)];
Pz = remez(25,f,mag);
Qz =1;
Hremez = freqz(Pz,Qz);
omega = 0:1/512:511/512;
figure(1)
subplot(2,1,1)
plot(omega,abs(Hremez))
xlabel(‘frequency in rad’)
ylabel(‘magnitude’)
title(‘Mag./FIR using remez’)
grid on;
subplot(2,1,2)
plot(o m e ga,u nw rap(a n gle(H r e m ez)))
xlabel(‘frequency in rad’)
ylabel(‘phase’)
title(‘Phase/FIR using remez’)
grid on;
% Design of FIR using fir1/Hamming window
Pz1 = fir1(25,0.3);
win = hamming(26);
Pz1= Pz1.*win’;
Hfir1= freqz(Pz1,1);