ex4_7.m

来自「Advanced Engineering Mathematics using M」· 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 matrixdetA=det(A)               % Compute the determinant andtraceA=sum(diag(A))       %  Same as trace commandpause%% 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 + -
显示快捷键?