PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

302 Practical MATLAB® Applications for Engineers


XL = j*w.*L;ZS=R2+XL;
ZP = (ZS.*XC)./(ZS+XC);
ZT = R1+ZP;
YT =1./ZT;
I = V./ZT;
VC = (V.*ZP)./ZT;
figure(1)
subplot(2,2,1)
plot(w,abs(ZT))
grid on
set(gca,’fontsize’,9)
title(‘abs[ZT(w)] vs. w’,’FontSize’,9)
ylabel(‘Amplitude (Ohms)’)
subplot(2,2,2)
plot(w,angle(ZT)*deg)
grid on
set(gca,’FontSize’,9)
title(‘angle[ZT(w)] vs. w’,’FontSize’,9)
ylabel(‘Angle (degrees)’)
subplot(2,2,3)
plot(w, abs(YT))
grid on
set(gca,’FontSize’,9)
title(‘abs(YT) vs. w’,’FontSize’,9)
xlabel(‘frequency w (rad/sec)’), ylabel(‘Amplitude (Ohm^-1)’)
subplot(2,2,4)
plot(w,angle(YT)*deg)
grid on
set(gca,’FontSize’,9)
title(‘angle(YT) vs. w’,’FontSize’,9)
xlabel(‘frequency in w (rad/sec)’), ylabel(‘Angle (degrees)’)
figure(2)
subplot(2,2,1)
plot(w,abs(I))
grid on
set(gca,’fontsize’,9)
title(‘abs[I(w)] vs. w’,’FontSize’,9)
ylabel(‘Current (amps)’)
subplot(2,2,2)
plot(w,angle(I)*deg)
grid on
set(gca,’FontSize’,9)
title(‘angle[I(w)] vs. w’,’FontSize’,9)
ylabel(‘angle (degrees)’)
subplot(2,2,3)
plot(w, abs(VC))
grid on
set(gca,’FontSize’,9)
title(‘abs(VC) vs. w’,’FontSize’,9)
xlabel(‘frequency w (rad/sec)’), ylabel(‘Amplitude (volts)’)
subplot(2,2,4)
plot(w,angle(VC)*deg)
grid on
set(gca,’FontSize’,9)
Free download pdf