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

    %% Generalized Eigenvalues  

%% 
% Create two matrices, |A| and |B|, then solve the generalized eigenvalue
% problem for the eigenvalues and right eigenvectors of the pair |(A,B)|.
A = [1/sqrt(2) 0; 0 1];
B = [0 1; -1/sqrt(2) 0];
[V,D]=eig(A,B)  

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

%%
% The residual error |A*V - B*V*D| is exactly zero.