Skip to content

poly

Polynomial Coefficients

poly(a)

  • a should be a vector or a square matrix.
  • If a is a vector, it returns cofficients of the polynomial with roots given by a. The first coefficient corresponds to the highest order term.
  • If a is a square matrix, it returns coefficients of the characteristic polynomial of a, i.e., $$ \det(a-I\lambda)=0. $$
  • a should not contain inf or nan values.
  • If a is a logical or character array, it will be converted to a double array before executing poly(a).
  • If a is empty, it returns 1.

Example 1: Plotting the polynomial having roots [3 4 5].

r=[3 4 5];
p=poly(r);
x=linspace(2.8,5.5);
plot(x,polyval(p,x))
p =
 1.000  -12.00   47.00  -60.00

Plot is generated.

Plot

Example 2: Coefficients of characteristic polynomial of a matrix.

A=[1 2;3 4];
p=poly(A)
p =
 1.000  -5.000  -2.000