Circuit Theory/Phasors/Examples/example11/code

From Wikibooks, open books for an open world
Jump to: navigation, search
v_S := Symbol::subScript(v,S);
v_1 := Symbol::subScript(v,1);
v_2 := Symbol::subScript(v,2);
v_3 := Symbol::subScript(v,3);
v_4 := Symbol::subScript(v,4);
i_1 := Symbol::subScript(I,1);
i_2 := Symbol::subScript(I,2);
i_3 := Symbol::subScript(I,3);
R_1 := Symbol::subScript(R,1);
R_2 := Symbol::subScript(R,2);
linsolve ([v_1 + v_s - v_3 = 0, 
v_2+v_4-v_3 = 0,
v_4 = L*w*I*i_2,
i_2 = I*w*C*v_2,
v_1/R_1 + I*w*C*v_2 + v_3/R_2 = 0],
[v_1,v_2,v_3,v_4,i_2]);
w:=1;L:=1;C:=2;R_1:=1;R_2:=2;v_s:=1;
linsolve ([v_1 + v_s - v_3 = 0, 
v_2+v_4-v_3 = 0,
v_4 = L*w*I*i_2,
i_2 = I*w*C*v_2,
v_1/R_1 + I*w*C*v_2 + v_3/R_2 = 0],
[v_1,v_2,v_3,v_4,i_2]);