compan - Companion matrix
Syntax
A = compan(u)
Description
A = compan(u) returns the corresponding
companion matrix whose first row is -u(2:n)/u(1), where u is
a vector of polynomial coefficients. The eigenvalues of compan(u) are
the roots of the polynomial.
Examples
The polynomial
has a companion matrix
given by
u = [1 0 -7 6]
A = compan(u)
A =
0 7 -6
1 0 0
0 1 0The eigenvalues are the polynomial roots:
eig(compan(u))
ans =
-3.0000
2.0000
1.0000This is also roots(u).
See Also
eig, poly, polyval, roots
 | commandwindow | | compass |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit