PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Fourier and Laplace 429


Zs = [5+2*s -2*s;-2*s 10+2*s];
Vs = [100/s;0];
Is = inv(Zs)*Vs;
it = ilaplace(Is);VLs=(Is(1)-Is(2))/(2*s);
disp(‘******************************************’)
disp(‘*********** R E S U L T S *************’)
disp(‘*********** C U R R E N T S **************’)
disp(‘The loop currents i1(t) and i2(t) (in amps) are: ‘)
disp(‘i1(t)=’),pretty(it(1))
disp(‘i2(t)=’),pretty(it(2))
disp(‘********************************************’)
disp(‘The currents i1(t=0) and i2(t=0) (in amps)’)
disp(‘using the initial value theorem are:’)
i1 _ 0 = limit(s*Is(1),s,inf)
i2 _ 0 = limit(s*Is(2),s,inf)
disp(‘*********************************************’)
disp(‘The current i1(t=inf) and i2(t=inf) (in amps)’)
disp(‘ using the final value theorem are :’)
i1 _ inf =limit(s*Is(1),s,0)
i2 _ inf =limit(s*Is(2),s,0)
disp(‘************ V O L T A G E S**************** ‘)
disp(‘The voltage across the inductor L (in volts) is given by:’)
VL _ t=ilaplace(VLs)
disp(‘The voltage across the resistor R1 (in volts) is given by:’)
VR1 _ t=5*it(1)
disp(‘The voltage across the resistor R2 (in volts) is given by:’)
VR2 _ t=10*it(2)
disp(‘********************************************’)

figure(1)
subplot (3,1,1)
ezplot(it(1))
title(‘i1(t) vs t’);xlabel(‘time (sec)’)
ylabel(‘ Amplitude (amps)’);axis([0 2 0 21]);
subplot(3,1,2)
ezplot(it(2))
title(‘i2(t) vs t’);axis([0 2 0 8]);
xlabel(‘time (sec)’);ylabel(‘ Amplitude (amps)’)
subplot(3,1,3)
ezplot(it(1)-it(2))
title(‘iL(t) vs. t’);axis([0 2 0 8]);
xlabel(‘time (sec)’);ylabel(‘ Amplitude (amps)’)
axis([0 2.5 0 21])

figure(2)
subplot (3,1,1)
ezplot(VR2 _ t)
title(‘VL(t) vs t’);xlabel(‘time (in sec)’)
ylabel(‘ Amplitude (in volts)’);axis([0 3 0 110]);
subplot(3,1,2)
ezplot(VR1 _ t)
title(‘VR1(t) vs t’); axis([0 3 0 110]);
xlabel(‘time (in sec)’);ylabel(‘ Amplitude (in volts)’)
Free download pdf