-1

Suppose I have a Matlab expression consisting of a ratio of polynomials of the symbolic variable 'x'. The polynomial coefficients are likewise symbolic. Is there a simple way to extract the numerator and the denominator of the expression? It is fine if the function returns either the polynomials or their coefficients.

Gabriel
  • 27
  • 6

1 Answers1

1

Yes there is. If you search google "MATLAB symbolic numerator denominator" the following documentation appears: numden

[N,D] = numden(A)

Example from MATLAB:

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

n = 
x^2 + y^2

d = 
x*y
Ander Biguri
  • 35,140
  • 11
  • 74
  • 120