PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Direct Current and Transient Analysis 189


figure(2)
subplot(3,1,1)
plot(t,it)
title(‘plots of [i(t), vr(t), and vL(t)] vs t’)
ylabel(‘i(t) in amps’)
subplot(3,1,2)
vr=R*it’;
plot(t,vr);ylabel(‘vr(t) in volts’);
subplot(3,1,3)
vl=20*ones(1,45)-vr;plot(t,vl);
ylabel(‘vL(t) in volts ‘);xlabel(‘time in sec’)
function didt=f(t,i)
didt=20-2*i;
The script fi le RC_ IC is executed, and the results and plots are shown in Figures 2.90
and 2.91.
>> RC _ IC
***************************************
**********R E S U L T S **************
***************************************
The i(t) for t >0 is:
it _ 1 =
10-5*exp(-2*t)
The voltage across R=2 ohms is :
vtr _ 1 =
20-10*exp(-2*t)
The voltage across L=1 henry is :
vl _ 1 =
10*exp(-2*t)
********Verify solution************
verify = diff(it _ 1,t)+2*it _ 1
verify =
20
*************************************

FIGURE 2.90
Plots of symbolic transient solutions of Example 2.26.

1.41.21 21.81.6
t

t

0.60.40.20 0.8

6

8

10

plots of: [i(t), vr(t), and vL(t)] versus t

i(t) in amps

vr(t)

vL(t)

0.60.40.20 1.41.210.8 21.81.6

10

15

20

1.41.21 21.81.6
time in sec

0.60.40.20 0.8

0

5

10
Free download pdf