Structure Consisting of the Fields
A MATLAB can also solve the sets of equations. In this illustration, the solutions for x, y, & z are returned as a structure consisting of the fields for x, y, & z. The separate solutions are symbolic expressions stored in the fields of structure.
>> solve('4*x-2*y + z=7' , 'x+ y+ 5*z=10' , '-2*x+ 3*y-z=2')
x: [1x1 sym]
y: [1x1 sym]
z: [1x1 sym]
To refer to the separate solutions, that are in the structure fields, the dot operator is used.
>> x = ans.x
>> y = ans.y
>> z = ans.z
The double function can therefore be used to convert the symbolic expressions to numbers, and store the outcomes from the three unknowns in a vector.
>> double([x y z])
3.0244 2.9512 0.8049