A = compan(p)
A = compan(p)
where p
is a vector of polynomial coefficients, returns the corresponding companion matrix whose first row is -p(2:n)/p(1)
.
The eigenvalues of compan(p)
are the roots of the polynomial.
has a companion matrix given by
The eigenvalues are the polynomial roots:p = [1 0 -7 6]
A = compan(p)
A =
0 7 -6
1 0 0
0 1 0
This is alsoeig(compan(p)) =
-3.0000
2.0000
1.0000
roots(p)
.
eig
,poly
,polyval
,roots
(c) Copyright 1994 by The MathWorks, Inc.