Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

poly - Compute characteristic polynomial of matrix

Syntax

p = poly(A)
p = poly(A, v)
poly(sym(A))

Description

p = poly(A) returns the coefficients of the characteristic polynomial of a numeric matrix A. For symbolic A, poly(A) returns the characteristic polynomial of A in terms of the default variable x. If the elements of A already contain the variable x, the default variable is t. If the elements of A contain both x and t, the default variable is still t.

p = poly(A, v), for both numeric and symbolic matrices, returns the characteristic polynomial of A in terms of the variable v.

poly(sym(A)), for numeric A, approximately equals poly2sym(poly(A)). The approximation is due to roundoff error.

Examples

Compute characteristic polynomials of one of the MATLAB test matrices:

syms z
A = gallery(3) 
p = poly(A)
q = poly(sym(A))
s = poly(A, z)

The results are:

A =
  -149   -50  -154
   537   180   546
   -27    -9   -25

p =
    1.0000   -6.0000   11.0000   -6.0000

q =
x^3 - 6*x^2 + 11*x - 6
 
s =
z^3 - 6*z^2 + 11*z - 6
 

Compute the characteristic polynomials of the following symbolic matrix in terms of the default variable. Also compute the characteristic polynomials in terms of the specified variable y:

syms x y;
B = x*hilb(3)
a = poly(B)
b = poly(B, y)

The results are:

B =
[   x, x/2, x/3]
[ x/2, x/3, x/4]
[ x/3, x/4, x/5]
 
a =
t^3 - (23*t^2*x)/15 + (127*t*x^2)/720 - x^3/2160
 
b =
- x^3/2160 + (127*x^2*y)/720 - (23*x*y^2)/15 + y^3

See Also

eig | jordan | poly2sym | solve

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS