MATLAB no longer displaying fractions in symbolic calculation.

28 vues (au cours des 30 derniers jours)
Michael Tamajong
Michael Tamajong le 23 Fév 2021
My MATLAB no longer displays results in fraction form, even in symbolic calculations.
say I want to do the fraction addition of 1/3 and 1/2, I type
sym(1/3)+sym(1/2)
I get the result: 0.8333
I have tried to do many other symbolic calculations but all fractions are now converted to decimal in the format short.
code
syms t
f(t)=exp(t/100)*sin(t/4)
I=int(f,t)
result:
f(t) =
I(t) =
I need theresults to be in fractional form, not in the format short.

Réponse acceptée

Walter Roberson
Walter Roberson le 23 Fév 2021
sympref('FloatingPointOutput', false)
  2 commentaires
Michael Tamajong
Michael Tamajong le 23 Fév 2021
Modifié(e) : Michael Tamajong le 23 Fév 2021
THANKS, this was really helpful. Just did what I expected.
for curiosity, I learned that to switch back to the previous format I can just change the false to true.
that one line answer has made my day.
Emmanuel J Rodriguez
Emmanuel J Rodriguez le 6 Août 2021
Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by