www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/TestifHermitianMatrixIsSymmetricExample.m
%% Test if Hermitian Matrix Is Symmetric %% % Create a 3-by-3 matrix. A = [1 0 1i; 0 1 0;-1i 0 1] %% % The matrix is Hermitian and has a real-valued diagonal. %% % Test whether the matrix is symmetric. tf = issymmetric(A) %% % The result is logical |0| (|false|) because |A| is not symmetric. In this % case, |A| is equal to its complex conjugate transpose, |A'|, but not its % nonconjugate transpose, |A.'|. %% % Change the element in |A(3,1)| to be |1i|. A(3,1) = 1i; %% % Determine whether the modified matrix is symmetric. tf = issymmetric(A) %% % The matrix, |A|, is now symmetric because it is equal to its nonconjugate % transpose, |A.'|.