www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/MatrixEvaluationOfCharacteristicPolynomialExample.m

    %% Matrix Evaluation of Characteristic Polynomial
% Find the characteristic polynomial of a Pascal Matrix of order 4.

% Copyright 2015 The MathWorks, Inc.

X =  pascal(4)
p = poly(X)

%%
% The characteristic polynomial is
%
% $$p(x) = x^4 - 29x^3 + 72x^2  -29x + 1$$
%
% Pascal matrices have the property that the vector of coefficients of the
% characteristic polynomial is the same forward and backward (palindromic).

%%
% Substitute the matrix, |X|, into the characteristic equation, |p|. The
% result is very close to being a zero matrix. This example is an instance
% of the Cayley-Hamilton theorem, where a matrix satisfies its own
% characteristic equation.
Y = polyvalm(p,X)