MATLAB no longer displaying fractions in symbolic calculation.

조회 수: 28 (최근 30일)
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.

채택된 답변

Walter Roberson
Walter Roberson 2021년 2월 23일
sympref('FloatingPointOutput', false)
  댓글 수: 2
Michael Tamajong
Michael Tamajong 2021년 2월 23일
편집: Michael Tamajong 2021년 2월 23일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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