フィルターのクリア

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 can I solve?

2 ビュー (過去 30 日間)
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

採用された回答

Walter Roberson
Walter Roberson 2020 年 12 月 11 日
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.
  2 件のコメント
Paolo
Paolo 2020 年 12 月 11 日
I erased the i1=0; i2=0; i3=0; i4=0;. But I still have the same problem. Why is the now?. What can I do to print the 11 i's that I need?
Code:
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');
end
Walter Roberson
Walter Roberson 2020 年 12 月 11 日
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');
These is the 4 equations:
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');
The matrix of voltage:
disp(V)
171 12 12 12 12 12 12 12 12 12 12 104 79 12 12 12 12 12 12 12 12 12 104 12 79 12 12 12 12 12 12 12 12 104 12 12 79 12 12 12 12 12 12 12 104 12 12 12 79 12 12 12 12 12 12 104 12 12 12 12 79 12 12 12 12 12 104 12 12 12 12 12 79 12 12 12 12 104 12 12 12 12 12 12 79 12 12 12 104 12 12 12 12 12 12 12 79 12 12 104 12 12 12 12 12 12 12 12 79 12 104 12 12 12 12 12 12 12 12 12 79
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');
end
The value for i1 is:
0.0137
The value for i2 is:
0.0238
The value for i3 is:
0.0533
The value for i4 is:
0.0108
Going to the next configuration
The value for i1 is:
0.0201
The value for i2 is:
0.0196
The value for i3 is:
0.0572
The value for i4 is:
0.0178
Going to the next configuration

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by