如何用用matlab求一个n阶矩阵A的伴随矩阵呢?

2020-10-07 教育 203阅读
matlab中没有直接求伴随矩阵的函数,所以可以通过编写程序实现。可参照:
function B = adj(A)
%求伴随矩阵
%ADJ Matrix adjoint.
% ADJ(A) is the adjoint matrix of square matrix A.
% It is computed using the Cayley-Hamilton Theorem.
% The inverse of A is: INV(A) = ADJ(A)/det(A).
%
% Matrices that are not invertable still have an adjoint.
%written by Paul Godfrey, April, 1998
%pjg@mlb.semi.harris.com
ce = poly(eig(A));
cesize = max(size(ce));
p = [0 ce(1:(cesize-1))];
s = (-1)^(max(size(A))+1);
B = s*polyvalm(p,A);
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com