PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Fourier and Laplace 441


where
Zs

s
s
()




20 10
10 20










and

Vs

s
()

100
0

 





MATLAB Solution
% Script file: loop _ diffeqs
syms s Zs Is Vs
Zs = [s+20 -10;-10 s+20];
Vs = [100/s;0];
Is = inv(Zs)*Vs;
disp(‘*********************************************’)
disp(‘********* Matlab Symbolic Results **********’)
disp(‘*********************************************’)
disp(‘The loop currents I1(s) and I2(s) are: ‘)
disp(‘I1(s)=’),pretty(Is(1))
disp(‘I2(s)=’),pretty(Is(2))
disp(‘*********************************************’)
i1 _ t = ilaplace(Is(1));
i2 _ t = ilaplace(Is(2));
disp(‘The loop currents i1(t) and i2(t)(in amp) are: ’)
disp(‘i1(t)=’),
simplify(i1 _ t)
disp(‘i2(t)=’),
simplify(i2 _ t)
disp(‘**********************************************’)
disp(‘The initial currents:i1(t=0) and i2(t=0)(in amps)’)
disp(‘using the initial value theorem are evaluated below’)
I1 _ 0 = limit(s*Is(1),s,inf)
I2 _ 0 = limit(s*Is(2),s,inf)
disp(‘**********************************************’)
disp(‘The final currents:i1(t=inf) and i2(t=inf)(in amps)’)
disp(‘using the initial value theorem are:’)
I1 _ inf = limit(s*Is(1),s,0)
I2 _ inf = limit(s*Is(2),s,0)
disp(‘**********************************************’)
figure(1)
subplot(1,2,1)
ezplot(i1 _ t);axis([0 .5 0 7])
title(‘i1(t) vs t’),xlabel(‘time (sec)’)
ylabel(‘i1(t) in amp’)
subplot(1,2,2)
ezplot(i2 _ t);axis([0 .5 0 3.5])
title(‘i2(t) vs t’)
xlabel(‘ time (sec) ‘)
ylabel(‘i2(t) in amp ‘)

The script fi le loop_diffeqs is executed and the results are as follows:
Free download pdf