PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Direct Current and Transient Analysis 163


ANALYTICAL Solution

For t < 0, the switch is in position a. Therefore,

vc(t) = 0

and

ic(t) = 0

For 0 < t < (t 1 = 2) seconds, the switch is in position b. Then,


vt VC e
() ( t/)
01 ^1


and

it
Vvt
C RR
() C()


0
13



where τ 1 = (R 1 + R 3 ) C = 10 Ω (^) 0.5 F = 5 s.
At time t = t 1 = 2 s, the voltage across the capacitor is
vtCC()Vmax V( e )
10 ^1 ^2 /^1
For t > (t 1 = 2 s), the switch is back in position a. Then
vt VCCe
() max ()/tt^12 
and
it
vt
C RR
() C()


(^32)
where τ 2 = (R 2 + R 3 )
C = 4 Ω (^) * 0.5 F = 2 s.
MATLAB Solution




V = 100; R1 =7; R2 =1; R3=3; C =0.5; % circuit elements
tau1 = (R1+R3)C % time constant #1
tau1 =
5
tau2 = (R2+R3)
C % time constant #2
tau2 =
2
for k =1:40
t(k) = k/20; % 0 < t < 2
v(k) = V*(1-exp(-t(k)/tau1));
i(k) = (V-v(k))/(R1+R2);
end



Free download pdf