MATLAB polynomial

Create polynomial

Insert picture description here
Write the following format in MATLAB to create an expression polynomial
p = [a0 a1 a2……… an-1 an];

MATLAB will automatically assign the vector elements to the coefficient values ​​in descending order.

p = [-9 2 -3 6 -56];
poly2sym(p)

Operation result: The
Insert picture description here
poly2symfunction can express a polynomial vector into a symbolic polynomial form.

Create characteristic polynomial
  • The leading coefficients of the polynomials generated by the characteristic polynomials are all 1.
  • The characteristic matrix of order n generally produces a polynomial of order n.
a = [1 2 3; 4 5 6; 7 8 9];
p1 = poly(a)
poly2sym(p1)

operation result:
Insert picture description here

Create polynomial from roots

Generate a polynomial with real coefficients, and the complex number in the root must correspond to the conjugate.

root = [-5 -3+4i -3-4i];
p = poly(root)
poly2sym(p)

operation result:
Insert picture description here

Find the roots of a polynomial

Insert picture description here
Created from a polynomial:

p = [1 -4 0 12 -9];

Using the rootsfunction or companfunctions with the eigfunctions can be obtained using all the roots of a polynomial.

Calculation result:
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_44989881/article/details/112587253