MATLAB: How to get all the coefficients of a polynomial with symbolic coefficients

coefficientpolynomialpowersymbolicsymbolic coefficient

I tried this
syms f1 f2 z
a = (f1-f2)*z^2 + f1*z +1
coeffes(a,z,'all')
I expected to get [f1-f2, f1, 1]But it reports error. Does anyone know any other methods to do this?

Best Answer

The method you are using is correct. Your spelling of the coeffs function is not.
Try this:
syms f1 f2 z
a = (f1-f2)*z^2 + f1*z + 1;
[cfs,trms] = coeffs(a,z,'all')
cfs =
[ f1 - f2, f1, 1]
trms =
[ z^2, z, 1]