return the numerator and denimentor
Show older comments
Hi everyone
Is there such a way to return the numerator and the denomenator of a given rational number
for example x = 1/2
I want to get n=1 , d=2
Accepted Answer
More Answers (1)
If x is a symbolic variable, then yes
>> x=sym(1/2);
>> [n,d]=numden(x)
n =
1
d =
2
1 Comment
Fatma Alnabrisi
on 9 Dec 2019
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!