Jump to content

Circuit Theory/1Initial and Source/Example30/code

From Wikibooks, open books for an open world
Vo=20;
R1 = 6000;
R2 = 2000;
R3 = 10.01;
C2 = .00047;
Vc2 = Vo*R2/(R1 + R2);
Req = R2*R3/(R2+R3);
tau = Req*C2;
syms time A C;
Vc2t = A * exp(-time/tau) + C;
eq1 = Vc2 - A - C
eq2 = - C2*diff(Vc2t,time) - Vc2t/Req;
time = 0;
eq3 = subs(eq2);
vpa(eq3,3)
S = solve(eq1,eq3,A,C);
S = [S.A S.C];
A = S(1);
C = S(2);
vpa(A,3)
vpa(C,3)
syms t;
eq4 = (A * exp(-t/tau) + C)/Req;
vpa(eq4,3)
vpa(tau,3)
vpa(Vc2,3)
vpa(Vc2/Req,3)