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

    %% Test if Symmetric Matrix Is Hermitian  

%% 
% Create a 3-by-3 matrix. 
A = [1 0 1i; 0 1 0; 1i 0 1] 

%%
% The matrix is symmetric with respect to its real-valued diagonal.  

%% 
% Test whether the matrix is Hermitian. 
tf = ishermitian(A) 

%%
% The result is logical |0| (|false|) because |A| is not Hermitian. In this
% case, |A| is equal to its transpose, |A.'|, but not its complex conjugate
% transpose, |A'|.

%% 
% Change the element in |A(3,1)| to be |-1i|. 
A(3,1) = -1i;  

%% 
% Determine if the modified matrix is Hermitian. 
tf = ishermitian(A) 

%%
% The matrix, |A|, is now Hermitian because it is equal to its complex
% conjugate transpose, |A'|.