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

    %% Find Condition of Identity Matrix  
% Examine why the reciprocal condition number is a more accurate measure
% of singularity than the determinant.   

%% 
% Create a 5-by-5 multiple of the identity matrix. 
A = eye(5)*0.01; 

%%
% This matrix is full rank and has five equal singular values, which you
% can confirm by calculating |svd(A)|.  

%% 
% Calculate the determinant of |A|. 
det(A) 

%%
% Although the determinant of the matrix is close to zero, |A| is actually
% very well conditioned and _not_ close to being singular.  

%% 
% Calculate the reciprocal condition number of |A|. 
rcond(A) 

%%
% The matrix has a reciprocal condition number of |1| and is, therefore,
% very well conditioned. Use |rcond(A)| or |cond(A)| rather than |det(A)|
% to confirm singularity of a matrix.