%% Characteristic Polynomial of Matrix
% Use poly to calculate the characteristic polynomial of a matrix, A.

A = [1 2 3; 4 5 6; 7 8 0]

%

p = poly(A)

%
% Calculate the roots of p using roots. The roots of the characteristic polynomial are the eigenvalues of matrix A.

r = roots(p)

% Copyright 2015 The MathWorks, Inc.