syms i1 i2 i3 i4 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11;
eqn1 = 3-r1*(i1)-r2*(i1-i4)-r3*(i1+i2)-r4*i1==0;
eqn2 = 3-r7*(i2 + i3)-r8*(i2+i4)-r3*(i2+i1)-r5*(i2)-r6*(i2+i3)== 0;
eqn3 = 3-r7*(i2+i3)-r10*(i3-i4)-r6*(i3+i2)-r9*i3==0;
eqn4 = r2*(i4-i1)+r8*(i2+i4)+r10*(i4-i3)+r11*i4==0;
Eqn=[eqn1; eqn2; eqn3; eqn4];
fprintf('These is the 4 equations: \n');
disp(Eqn);
v1=[171;104;104;104;104;104;104;104;104;104;104];
v2=[12;79;12;12;12;12;12;12;12;12;12];
v3=[12;12;79;12;12;12;12;12;12;12;12];
v4=[12;12;12;79;12;12;12;12;12;12;12];
v5=[12;12;12;12;79;12;12;12;12;12;12];
v6=[12;12;12;12;12;79;12;12;12;12;12];
v7=[12;12;12;12;12;12;79;12;12;12;12];
v8=[12;12;12;12;12;12;12;79;12;12;12];
v9=[12;12;12;12;12;12;12;12;79;12;12];
v10=[12;12;12;12;12;12;12;12;12;79;12];
v11=[12;12;12;12;12;12;12;12;12;12;79];
V=[v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11];
fprintf('The matrix of voltage: \n');
disp(V)
j=0;
while j<2
j=j+1;
eq1 = 3-V(j,1)*(i1)-V(j,2)*(i1-i4)-V(j,3)*(i1+i2)-V(j,4)*i1==0;
eq2 = 3-V(j,4)*(i2 + i3)-V(j,8)*(i2+i4)-V(j,3)*(i2+i1)-V(j,5)*(i2)-V(j,6)*(i2+i3)== 0;
eq3 = 3-V(j,7)*(i2+i3)-V(j,10)*(i3-i4)-V(j,6)*(i3+i2)-V(j,9)*i3==0;
eq4 = V(j,2)*(i4-i1)+V(j,8)*(i2+i4)+V(j,10)*(i4-i3)+V(j,11)*i4==0;
I=solve(eq1, eq2, eq3, eq4);
k1 = double(I.i1);
k2 = double(I.i2);
k3 = double(I.i3);
k4 = double(I.i4);
P= V(j,1)*k1^2+V(j,2)*k1^2+V(j,3)*k1^2+V(j,4)*k1^2+V(j,4)*k2^2+V(j,8)*k2^2+V(j,3)*k2^2+V(j,5)*k2^2+V(j,6)*k2^2+V(j,7)*k3^2+V(j,10)*k3^2+V(j,6)*k3^2+V(j,9)*k3^2+V(j,2)*k4^2+V(j,8)*k4^2+V(j,10)*k4^2+V(j,11)*k4^2;
fprintf('The value for i1 is: \n');
disp(k1);
fprintf('The value for i2 is: \n');
disp(k2);
fprintf('The value for i3 is: \n');
disp(k3);
fprintf('The value for i4 is: \n');
disp(k4);
fprintf('The power is: \n');
disp(P);
fprintf('Going to the next configuration\n\n');
end
Best Answer