can you change fraction to decimal when using linsolve
4 views (last 30 days)
Show older comments
I was wondering, when i get my output for X = linsolve(A,B); I get it in the form of a fraction, i want this to be in the form of a decimal, how would I go about doing this?
Along with that, I want to be able to display each value from X (in decimal form) as an answer to each other the "the long term distribution...". And i am also not sure how to go about doing that as well. Any help is appreciated. thanks.
syms x y z
eqn1 = 0.63*x + 0.30*y + 0.41*z == x;
eqn2 = 0.25*x + 0.45*y + 0.41*z == y;
eqn3 = 0.12*x + 0.25*y + 0.18*z == z;
eqn4 = x + y + z == 1;
[A,B] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4], [x, y, z]);
%disp(A,B)
%disp(B)
X = linsolve(A,B);
disp('The long term distribustion of Profession Jobs is:');
disp('The long term distribustion of Service Jobs is:');
disp('The long term distribustion of Manufacturing Jobs is:');
0 Comments
Answers (1)
Star Strider
on 26 Apr 2020
Depending on the result you want, either:
X = double(linsolve(A,B));
or:
X = vpa(linsolve(A,B));
.
2 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!