PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

606 Practical MATLAB® Applications for Engineers


subplot(2,1,1);
semilogx(w/(2*pi),db);
ylabel(‘magnitude in dbs’);
title(‘magnitude vs. freqs.’);
axis([1.9e2 1.4e4 -50 2]);
grid on;
subplot(2,1,2);
semilogx(w/(2*pi),angle(Hhp)*180/pi);
title(‘phase ang. vs. freqs.’);
ylabel(‘phase in degrees’);
xlabel(‘frequency in Hrz’);
axis([1.9e3 1.4e4 0 90]);
grid on;

figure(3);
bode(num,den,w)
title(‘Bode plots with argument w’);
axis([5e3 2e5 0 100])

figure(4);
bode(num,den)
title(‘Bode plots with no w’);

figure(5)
% using standard circuit approach (complex algebra)
XC=1./(w.*C);
Z=sqrt(R^2+XC.^2);
magHele=(R./Z);
phaseHele=(atan(XC./R)).*180./pi;
subplot(2,2,1)
plot(w./(2*pi),magHele);
title(‘magnitude vs. freq.’);
ylabel(‘magnitude’)
grid on;
subplot(2,2,2)
plot(w./(2*pi),phaseHele);
title(‘phase vs. freq.’);
ylabel(‘phase in degrees’);
grid on;
subplot(2,2,3);
dbele=20.*log10(magHele);
semilogx(w./(2*pi),dbele);title(‘ magnitude vs. freq.’)
ylabel(‘magnitude(db)’);
xlabel(‘frequency in Hrz’);
grid on;
subplot(2,2,4);
semilogx(w./(2*pi),phaseHele);title(‘ phase vs. freq.’)
xlabel(‘frequency in Hrz’);
ylabel(‘phase(degrees)’);
grid on;
Back in the command window, the script fi le HP_fi lter_analysis is executed and the
results are shown as follows (Figures 6.32 through 6.36):
>> HP _ filter _ analysis
Free download pdf