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

    %% Eigenvalues and Eigenvectors of Matrix  

%% 
% Use |gallery| to create a circulant matrix. 
A = gallery('circul',3)  

%% 
% Calculate the eigenvalues and right eigenvectors of |A|. 
[V,D] = eig(A)  

%% 
% Verify that the results satisfy |A*V = V*D|. 
A*V - V*D 

%%
% Ideally, the eigenvalue decomposition satisfies the relationship. Since
% |eig| performs the decomposition using floating-point computations, then
% |A*V| can, at best, approach |V*D|. In other words, |A*V - V*D| is close
% to, but not exactly, |0|.