I think your mistake is here:
PolyCoeffs = coeffs(b,z);
PolyCoeffs = fliplr(PolyCoeffs);
You have to flip it because the function Coeffs
give coefficient in the opposite order for example:
syms x
c = coeffs(16*x^2 + 19*x + 11)
c =
[ 11, 19, 16]
and function roots
takes the other order for example:
The polynomial s3 – 6s2 – 72s – 27 is represented in MATLAB® software as
p = [1 -6 -72 -27]
The roots of this polynomial are returned in a column vector by
r = roots(p)
Good luck in your work.