When you use the SOLVE function (from the Symbolic Toolbox ) you can specify the variables you want to solve. For example, suppose you have three equations with variables x, yand zand constants aand b. The following will give you a structure Swith fields 'x', 'y'and 'z'containing symbolic equations for these variables, which include constants aand b:
>> S = solve('x+y=a','x-y=b','z=x^2+y^2','x','y','z'); %
>> [S.x; S.y; S.z] %
ans =
a/2 + b/2 %
a/2 - b/2 %
a^2/2 + b^2/2 %
If symbolic solutions cannot be found for the system of equations, numerical solutions will be returned instead.
source
share