can you change fraction to decimal when using linsolve

4 次查看(过去 30 天)
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:');

回答(1 个)

Star Strider
Star Strider 2020-4-26
Depending on the result you want, either:
X = double(linsolve(A,B));
or:
X = vpa(linsolve(A,B));
.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by