From: Walter Roberson on
Nick Todd wrote:
> I need to be able to represent a symbolic expression such as y = a^5*X^3
> + X + 1 , where the X^2 term is not present, as a vector ie. [a^5 0 1 1]
>
> I cannot use sym2poly because the expression contains more than one
> symbolic variable. The coeffs function seems appropriate but doesn't
> include the zero coefficient of X^2 ie returns [a^5, 1, 1].
>
> How can I get a coefficient vector which contains any zero coefficients
> that might be present in the symbolic representation?

See
http://www.mathworks.com/matlabcentral/newsreader/view_thread/276491#730341
"Extract numbers (coefficients) from a polynomial (sym)"