Matrix polynomial evaluation
Matrix Evaluation of Characteristic Polynomial
Find the characteristic polynomial of a Pascal Matrix of order 4.
X = pascal(4)
X = 4×4 1 1 1 1 1 2 3 4 1 3 6 10 1 4 10 20
p = poly(X)
p = 1×5 1.0000 -29.0000 72.0000 -29.0000 1.0000
The characteristic polynomial is
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)
Y = 4×4 10-10 × -0.0003 -0.0036 -0.0052 -0.0143 -0.0021 -0.0136 -0.0179 -0.0464 -0.0059 -0.0330 -0.0400 -0.1047 -0.0130 -0.0639 -0.0750 -0.1962
X — Input matrix
Input matrix, specified as a square matrix.
Complex Number Support: Yes
Y — Output polynomial coefficients
Output polynomial coefficients, returned as a row vector.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Introduced before R2006a