%% Companion Matrix for Polynomial
% Compute the companion matrix corresponding to the polynomial (x-1)(x-2)(x+3) = x^3-7x+6.

u = [1 0 -7 6];
A = compan(u)

%
% The eigenvalues of A are the polynomial roots.

eig(A)

% Copyright 2012 The MathWorks, Inc.