Reputation: 2464
I am solving a system of linear equations. I want to output the variables with their respective solutions, displaying decimals (a double).
[A,B] = equationsToMatrix(eqs,vars);
res = [transpose(vars) double(linsolve(A,B))];
The value of transpose(vars)
is:
Ax
Ay
Az
Md
Me
And the values of double(linsolve(A,B))
is:
-75
450
-75
450
183.71
However when I concatenate these to vectors, I lose the decimal places, and irrational numbers are converted to fraction/symbolic form with radicals. The output of [transpose(vars) double(linsolve(A,B))]
is:
[ Ax, -75]
[ Ay, 450]
[ Az, -75]
[ Md, 450]
[ Me, 75*6^(1/2)]
How do I achieve an output with doubles? I want something similar to the following output:
[ Ax, -75.00]
[ Ay, 450.00]
[ Az, -75.00]
[ Md, 450.00]
[ Me, 183.71]
Upvotes: 1
Views: 32