- https://www.mathworks.com/matlabcentral/answers/336975-empty-sym-solution-when-using-symbolic-solve-function
- https://www.mathworks.com/matlabcentral/answers/1893540-got-this-empty-sym-0-by-1
solving systems of equations but returns empty solutions
5 ビュー (過去 30 日間)
古いコメントを表示
Hi, I am using solve in MATLAB to solve a system of equations where the code is given below and the right hand sides of each equation are actually given numerical values. I wonder why there is empty solutions in sol even there is no error occurred? Thank you for your kind help.
syms x1 x2 x3 y1 y2 y3 z1 z2 z3 u1 u2 u3 v1 v2 v3
eqns = [x1 + y1 + z1 + u1 + v1 == 5*E_e(1,1),...
x2 + y2 + z2 + u2 + v2 == 5*E_e(2,1),...
x3 + y3 + z3 + u3 + v3 == 5*E_e(3,1),...
x1*x1 + y1*y1 + z1*z1 + u1*u1 + v1*v1 == 5*E_ee(1,1),...
x1*x2 + y1*y2 + z1*z2 + u1*u2 + v1*v2 == 5*E_ee(1,2),...
x1*x3 + y1*y3 + z1*z3 + u1*u3 + v1*v3 == 5*E_ee(1,3),...
x2*x2 + y2*y2 + z2*z2 + u2*u2 + v2*v2 == 5*E_ee(2,2),...
x2*x3 + y2*y3 + z2*z3 + u2*u3 + v2*v3 == 5*E_ee(2,3),...
x3*x3 + y3*y3 + z3*z3 + u3*u3 + v3*v3 == 5*E_ee(3,3)];
vars = [x1,x2,x3,y1,y2,y3,z1,z2,z3];
sol = solve(eqns,vars);
0 件のコメント
回答 (2 件)
Ayush Modi
2024 年 8 月 30 日
Hi Nicky,
The reason "solve" function is returning an empty solution is because the set of equations you are trying to solve does not have a valid symbolic solution.
You can read the following MATLAB Answer threads for detailed explanations:
Hope this helps
0 件のコメント
Walter Roberson
2024 年 8 月 30 日
移動済み: Walter Roberson
2024 年 8 月 30 日
It is possible to solve the whole system.
Start by solving the first 7 equations, and substitute the results into the remaining equations. simplify() and then solve the remaining two equations. After that do the appropriate back substitution.
There will be 24 solutions, some of which might possibly be spurious.
Note: the simplified version turns out to be two pairs of equations repeated, rather than 4 distinct equations.
syms E_e [3,1]
syms E_ee [3,3];
syms x1 x2 x3 y1 y2 y3 z1 z2 z3 u1 u2 u3 v1 v2 v3
eqns = [x1 + y1 + z1 + u1 + v1 == 5*E_e(1,1),...
x2 + y2 + z2 + u2 + v2 == 5*E_e(2,1),...
x3 + y3 + z3 + u3 + v3 == 5*E_e(3,1),...
x1*x1 + y1*y1 + z1*z1 + u1*u1 + v1*v1 == 5*E_ee(1,1),...
x1*x2 + y1*y2 + z1*z2 + u1*u2 + v1*v2 == 5*E_ee(1,2),...
x1*x3 + y1*y3 + z1*z3 + u1*u3 + v1*v3 == 5*E_ee(1,3),...
x2*x2 + y2*y2 + z2*z2 + u2*u2 + v2*v2 == 5*E_ee(2,2),...
x2*x3 + y2*y3 + z2*z3 + u2*u3 + v2*v3 == 5*E_ee(2,3),...
x3*x3 + y3*y3 + z3*z3 + u3*u3 + v3*v3 == 5*E_ee(3,3)];
vars = [x1,x2,x3,y1,y2,y3,z2,z3,z1];
X = lhs(eqns(:)) - rhs(eqns(:));
K = 7;
sol = solve(X(1:K), vars(1:K))
eqns2 = subs(X(K+1:end).', sol);
eqns2s = simplify(eqns2);
for KK = 1 : size(eqns2s,1)
sol4(KK,1) = solve(eqns2s(KK,:), vars(K+1:K+2));
end
sol4(1)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Power and Energy Systems についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!