Simplifying results from rat function

조회 수: 4 (최근 30일)
Ken Bannister
Ken Bannister 2022년 1월 19일
답변: Walter Roberson 2022년 1월 19일
Suppose I have found the decimal value:
0.642857142857143
Which by the way I know to be 9/14
if I go:
result =rat(0.642857142857143)
I get the interesting symbolic output:
'1 + 1/(-3 + 1/(5))'
How do I now go about turning this symbolic numerical expression into something
like '9/14' ?
I thought maybe simplifyFraction would suffice, but looks like that is reserved for algebraic espressionss

채택된 답변

Walter Roberson
Walter Roberson 2022년 1월 19일
[N,D] = rat(0.642857142857143)
N = 9
D = 14

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by