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?

Réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by