ex4_7.m

来自「Programs for the book Advanced Engineeri」· M 代码 · 共 21 行

M
21
字号
% EX4_7.M Verify results of Example 4.7
%   Computes determinant and trace of a matrix and compares to
%     product and sum of eigenvalues, respectively.
%
A=[1 -1 0;0 1 1;0 0 -2]   % Define the matrix
detA=det(A)               % Compute the determinant and
traceA=sum(diag(A))       %  Same as trace command
pause
%
% Test using eigenvalues 
%
fprintf(' Determinant and trace from eigenvalues \n')
Eig=eig(A)              % Column vector of eigenvalues 
prodeig=prod(Eig)
traceA1=sum(Eig)

%
%  Modify the script to compute the eigenvalues and 
%   trace of an arbitrary matrix either input during a session
%   or saved in a disk file
%

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?