PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

626 Practical MATLAB® Applications for Engineers


phase2=angle(h2)*180/pi;
plot (w, phase2)
title (‘Phase of LPF with wc=3’)
xlabel (‘w in rad/sec’)
ylabel (‘degrees’)
[Pz,Qz]=bilinear (Pa,Qa,1/T); % discrete transfer function
disp(‘******************************************’)
disp(‘**************RESULTS******************* ‘)
disp(‘*******************************************’)
disp(‘Digital filter /numerator coefficients of the transfer
function :’)
disp(Pz)
disp(‘ Digital filter / denominator coefficients of the transfer func-
tion :’)
disp(Qz)
disp(‘*******************************************’)

figure(3); zplane (Pz,Qz)
title (‘zero-pole plot of H(z)’)

figure(4);pzmap(Pa,Qa)
title (‘zero-pole plot of H(s)’)

figure(5)
[magz, phasez] = freqz (Pz, Qz, w*T/pi);
subplot (1,2,1) % digital filter
plot (w*T, magz)
xlabel (‘W in rad’); title(‘Mag.of digital filter H(Z)’)
ylabel (‘magnitude’);axis([-2 2 0.4 1.1]);
subplot(1,2,2)
plot(w*T,phasez*180/pi)
xlabel(‘W in rad’); ylabel(‘degrees’);
title(‘Phase of digital filter H(z)’)

Back in the command window, the script fi le analog_digital is executed and the results
are shown as follows (Figures 6.53 through 6.57):

>> analog _ digital
******************************************
**************RESULTS*******************
******************************************
Digital filter /numerator coefficients of the transfer function :
0.0380 0.1141 0.1141 0.0380
Digital filter / denominator coefficients of the transfer function :
1.0000 -1.3445 0.8215 -0.1727
*******************************************
Free download pdf