MATLAB: Check for missing argument or incorrect argument data type in call to function ‘solve’. Error in LinearProject (line 35) I=solve(eq1, eq2, eq3, eq4); The program just print the first 4 i’s. The program should print 44 i’s. How to solve

for loopsolve

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);
i1 = double(I.i1);
i2 = double(I.i2);
i3 = double(I.i3);
i4 = double(I.i4);
fprintf('The value for i1 is: \n');
disp(i1);
fprintf('The value for i2 is: \n');
disp(i2);
fprintf('The value for i3 is: \n');
disp(i3);
fprintf('The value for i4 is: \n');
disp(i4);
fprintf('Going to the next configuration\n\n');
I=0;
i1=0;
i2=0;
i3=0;
i4=0;
end

Best Answer

syms i1 i2 i3 i4 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11;
i1 i2 i3 i4 start out as symbolic
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;
and get used in those equations, so those start out as symbolic equations
i1=0;
i2=0;
i3=0;
i4=0;
Now they are assigned numeric, so they are no longer symbolic. So when you loop back to eq1 etc, those become expressions of numeric values == numeric values, which gives a logical result, not symbolic.