PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Direct Current and Transient Analysis 205


or

di t
di

(^173) it 12 it
()
 () ()
and
 392 it 12 it^20
di t
di
() ()
()
 
or
(^239212)
di t
dt
it it
()
() ()
MATLAB Solution
% Script file : transient _ 2loops
% transient solutions for two loop network
disp(‘****’)
disp(‘*R E S U L T S*****’)
disp(‘****’)
disp(‘Solution of the two diff. loop equations for t>0 ’)
[y1 y2] = dsolve(‘Dy1=-7y1+3y2,2Dy2=3y1- 9*y2’,’y1(0)=3’,’y2(0)=2’,’t’);
figure(1)
ezplot (y1,[0 3])
axis([0 1.5 0 3.5])
xlabel (‘time (sec)’)
ylabel (‘current i1(t) in amps’)
title (‘i1(t) vs t ’)
figure(2)
ezplot(y2,[0 3])
axis([0 1.5 0 2.3])
xlabel(‘time (sec)’)
ylabel(‘current i2(t) in amps’)
title(‘i2(t) vs t ’)
disp(‘’)
disp(‘The currents i1(t) and i2(t), in amps are :’)
[y1 y2]’
disp(‘
’)
disp(‘The simplify solution for i1(t) is:’)
simplify(y1)
disp(‘’)
disp(‘The simplify solution for i2(t) is :’)
simplify(y2)
disp(‘
’)
disp(‘The pretty solution for i1(t) is :’)
pretty(y1)
disp(‘’)
disp(‘The pretty solution for i2(t) is :’)
pretty(y2)
disp(‘
’)

Free download pdf