Companion matrix
A = compan(u)
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.
-u(2:n)/u(1)
u
compan(u)
collapse all
Compute the companion matrix corresponding to the polynomial (x-1)(x-2)(x+3)=x3-7x+6.
u = [1 0 -7 6]; A = compan(u)
A = 3×3 0 7 -6 1 0 0 0 1 0
The eigenvalues of A are the polynomial roots.
A
eig(A)
ans = 3×1 -3.0000 2.0000 1.0000
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
eig | poly | polyval | roots
eig
poly
polyval
roots
You have a modified version of this example. Do you want to open this example with your edits?