Why do I get a fraction instead of a rational number when I solve two simple simultaneous equations
Show older comments
These are the two equations I need to solve; for A and B, to calculate the viscosity of hydraulic fluid between to temperatures. The results are correct, but why does Matlab show them as fractions and not rational numbers?
syms A B
eqn1=A-520*B==3.7612;
eqn3=A-560*B==2.3026;
[X,Y] = equationsToMatrix([eqn1, eqn3], [A, B])
Z = linsolve(X,Y)
Z =
22723/1000
7293/200000
>> 22723/1000
ans =
22.7230
>> 7293/200000
ans =
0.0365
Accepted Answer
More Answers (1)
Walter Roberson
on 21 Dec 2020
Edited: Walter Roberson
on 21 Dec 2020
1 vote
Use sympref to set symbolic output to floating-point.
1 Comment
Ali Kemal YELTER
on 21 Dec 2020
Thank you sir.
Categories
Find more on Systems Of Linear Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!