PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

306 Practical MATLAB® Applications for Engineers


title(‘[i(t)^2] vs. t’); ylabel (‘Amplitude’);
grid on
subplot(2,2,3)
inti=int(iamps);
ezplot(inti)
xlabel(‘ time ‘);ylabel(‘amplitide’);
title(‘integral[i(t)] vs. t’)
grid on
subplot(2,2,4)
diffi=diff(iamps);
ezplot(diffi)
xlabel(‘ time ‘); ylabel(‘Amplitude’)
title(‘d[i(t)/dt] vs.t’)
grid on
figure(2)
Vr=1000*iamps;
subplot(2,2,1)
ezplot(Vr)
title(‘vr(t) vs.t’);ylabel(‘voltage (volts)’)
grid on
subplot(2,2,2)
Vl=30e-3*diffi;
ezplot(Vl)
ylabel(‘ voltage (volts) ‘)
title(‘vl(t) vs.t’)
grid on
subplot(2,2,3)
Vc=.5e-6*inti;
ezplot(Vc)
title(‘vc(t) vs. t’)
xlabel(‘ time ‘)
ylabel(‘voltage (volts)’)
grid on
subplot(2,2,4)
Vlr=Vl+Vr;
ezplot(Vlr)
title(‘[vr(t)+vl(t)] vs. t’)
xlabel(‘ time ‘)
ylabel(‘voltage (volts)’)
grid on
figure(3)
Vcr =Vc+Vr;
subplot(2,2,1)
ezplot(Vcr)
title(‘[vr(t)+vc(t)] vs. t’)
ylabel(‘voltage (volts)’)
grid on
subplot(2,2,2)
Pr=iamps*Vr;
ezplot(Pr)
title(‘pr(t) vs. t’)
ylabel(‘power (watts)’)
grid on
Free download pdf