Extract numerator and denominator

- example
`[N,D] = numden(A)`

`[`

converts `N`

,`D`

] =
numden(`A`

)`A`

to
a rational form where the numerator and denominator are relatively
prime polynomials with integer coefficients. The function returns
the numerator and denominator of the rational form of an expression.

If `A`

is a symbolic or a numeric matrix,
then `N`

is the symbolic matrix of numerators,
and `D`

is the symbolic matrix of denominators.
Both `N`

and `D`

are matrices
of the same size as `A`

.

Find the numerator and denominator of a symbolic number.

[n, d] = numden(sym(4/5))

n = 4 d = 5

Find the numerator and denominator of the symbolic expression.

syms x y [n,d] = numden(x/y + y/x)

n = x^2 + y^2 d = x*y

Find the numerator and denominator of each element of a symbolic matrix.

syms a b [n,d] = numden([a/b, 1/b; 1/a, 1/(a*b)])

n = [ a, 1] [ 1, 1] d = [ b, b] [ a, a*b]

Was this topic helpful?