1. 程式人生 > >【 MATLAB 】poly 函式介紹

【 MATLAB 】poly 函式介紹

poly

Polynomial with specified roots or characteristic polynomial

Syntax

p = poly(r)

p = poly(A)

Description

p = poly(r),其中r是向量,返回其根是r元素的多項式的係數。

由多項式的根求多項式,由特徵多項式的根,即特徵值求特徵多項式。

特徵值的特徵多項式

Calculate the eigenvalues of a matrix, A.

計算矩陣 A 的特徵值

A = [1 8 -10; -4 2 4; -5 2 8]
A = 3×3

     1     8   -10
    -4     2     4
    -5     2     8

e = eig(A)
e = 3×1 complex

  11.6219 + 0.0000i
  -0.3110 + 2.6704i
  -0.3110 - 2.6704i

由於e中的特徵值是A的特徵多項式的根,因此使用poly從e中的值確定特徵多項式。

p = poly(e)
p = 1×4

    1.0000  -11.0000   -0.0000  -84.0000

所以特徵多項式可以寫為:

x^3  - 11x^2 - 84 = 0;

p = poly(A), 其中A是n×n矩陣,返回矩陣特徵多項式的n + 1個係數det(λI-A)。

由矩陣返回特徵多項式的係數。

Characteristic Polynomial of Matrix

Use poly to calculate the characteristic polynomial of a matrix, A.

A = [1 2 3; 4 5 6; 7 8 0]
A = 3×3

     1     2     3
     4     5     6
     7     8     0

p = poly(A)
p = 1×4

    1.0000   -6.0000  -72.0000  -27.0000

Calculate the roots of p using roots. The roots of the characteristic polynomial are the eigenvalues of matrix A

.

r = roots(p)
r = 3×1

   12.1229
   -5.7345
   -0.3884

再由根r來求其多項式y,可預期一樣,y 和 p一致。