MATLAB: Extract num and den in symbolic expression.

Control System Toolboxdennum

The 'tf' function in Control Systems needs numerator and denometer in a vector of decreasing powers of s.
For example a numerator of a*s^2 + b*s + c needs to be num= [a b c];. I have been cutting and pasting the necessary coefficients
but to do this I have to pause my program. Is there a way to extract the appropriate vector(s) programatically?
Thanks,
Bruce Taylor

Best Answer

Use the sym2poly funciton:
syms a b c s
num = 1*s^2 + 2*s + 3;
n = sym2poly(num)
n =
1 2 3