System of equations zero variable

I would like to solve the following series of equations
syms x y z
sol = solve([0*x + 1*y + 2*z ==4, x+y+z ==4], [x, y, z])
xsol = sol.x
ysol = sol.y
zsol = sol.z
Where the answers would be [0 4 0; 1 2 1; 2 0 2] but because MATLAB solves the first equation as 1y + 2z = 4 (removing the x variable because it's multiplied times 0) the only solution that it can come up with that satisfies both equations is 0 4 0. How do I fix this?

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by