PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Analog and Digital Filters 657


figure(2)
[num3,den3] = lp2lp(num1,den1,2); %. transf function /Butt
H3 = freqs(num3,den3,w);
subplot(2,2,1)
plot(w,abs(H3));
ylabel(‘magnitude’)
title(‘Butt. LPF ,wp=2’)
subplot(2,2,2);
plot(w,angle(H3)*180/pi)
ylabel(‘phase (deg)’)
title(‘Butt. LPF’)
[num4,den4] = lp2lp(num2,den2,2); % transf. function/Cheby
H4 = freqs(num4,den4,w);
subplot(2,2,3)
plot(w,abs(H4));
ylabel(‘magnitude’)
xlabel(‘frequency(rad/sec)’)
title(‘Cheb. LPF ,wp=2’)
subplot(2,2,4);
plot(w,angle(H4)*180/pi)
ylabel(‘phase (deg)’)
xlabel(‘frequency (rad/sec)’)
title(‘Cheb. LPF’)
figure(3)
[num5,den5] = lp2hp(num1,den1,2); %. transf. function /Butt
H5 = freqs(num5,den5,w);
subplot(2,2,1)
plot(w,abs(H5));
ylabel(‘magnitude’)
title(‘Butt. HPF ,wp=2’)
subplot(2,2,2);
plot(w,angle(H5)*180/pi)
ylabel(‘phase (deg)’)
title(‘Butt. HPF’)
[num6,den6] = lp2bp(num1,den1,2,1);
% transf function/Butt. cen-
ter freq of 1.5 and Bw =1
H6 = freqs(num6,den6,w);
subplot(2,2,3)
plot(w,abs(H6));
ylabel(‘magnitude’)
xlabel(‘frequency(rad/sec)’)
title(‘But.BPF ,cent freq=2,BW=1’)
subplot(2,2,4);
plot(w,angle(H6)*180/pi)
ylabel(‘phase (deg)’)
xlabel(‘frequency (rad/sec)’)
title(‘Butt. BPF’)
% part(e)
figure(4)
[num7,den7] = lp2bs(num1,den1,2,1);
% trasf. function/Butt.center freq at 1.5 and stop Bw =1
H7 = freqs(num7,den7,w);
subplot(2,2,1)
Free download pdf