Jump to content

Circuit Theory/2Source Excitement/Node and Mesh/mcode1

From Wikibooks, open books for an open world
syms va vb vc
v1 = 5*(sqrt(3) + i);
i1 = (1-i)/(2 * sqrt(2));
Zc1 = -10i;
Zc2 = -5i;
ZL = i;
R1 = 1000;
R2 = 500;
R3=2000;
S = solve((v1-va)/(R1 + ZL) + i1 - (va - vb)/Zc1, (va-vb)/Zc2 - vb/R3 - (vb-vc)/Zc2, (vb-vc)/Zc2 - i1 - vc/ZL, va,vb,vc)
S = [S.va S.vb S.vc];
VA = S(1);
VB = S(2);
VC = S(3);
vpa(VA,3)
vpa(VB,3)
vpa(VC,3)
vpa(abs(VA),3)
vpa(abs(VB),3)
vpa(abs(VC),3)
vpa(atan(imag(VA)/real(VA))-pi(),3)
vpa(atan(imag(VB)/real(VB))-pi(),3)
vpa(atan(imag(VC)/real(VC)),3)