- 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 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Ayush Modi
on 30 Aug 2024
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 Comments
Walter Roberson
on 30 Aug 2024
Moved: Walter Roberson
on 30 Aug 2024
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 Comments
See Also
Categories
Find more on Power and Energy Systems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!