can you change fraction to decimal when using linsolve

4 vues (au cours des 30 derniers jours)
Imani DaSilva
Imani DaSilva le 26 Avr 2020
Commenté : Star Strider le 26 Avr 2020
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:');

Réponses (1)

Star Strider
Star Strider le 26 Avr 2020
Depending on the result you want, either:
X = double(linsolve(A,B));
or:
X = vpa(linsolve(A,B));
.
  2 commentaires
Imani DaSilva
Imani DaSilva le 26 Avr 2020
Thank you.
It worked.
Star Strider
Star Strider le 26 Avr 2020
My pleasure!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by