ishermitianDetermine if a matrix is Hermitian or skew-Hermitian
A Hermitian matrix
If
is the element in Row and Column of , then for all and . That means, is the conjugate of .
A skew Hermitian matrix
If
is the element in Row and Column of , then for all and . That means, is the negation of the conjugate of .
ishermitian(A)A should be a numeric matrix. If A is a character array, it will be converted to a double array.A is hermitian, it returns logical 1. Otherwise, it returns logical 0.A is empty, it returns logical 1.A is not square or ndims(A) > 2, it returns logical 0.ishermitian(A, skew)A should be a numeric matrix. If A is a character array, it will be converted to a double array.skew has to be a character array, equal to either 'skew' or 'nonskew'.ishermitian(A,'nonskew') gives the same result as ishermitian(A).ishermitian(A,'skew') gives logical 1 when A is skew Hermitian.A is empty, it returns logical 1.A is not square or ndims(A) > 2, it returns logical 0.B is a real Hermitian matrix.A = [1 2 3;4 5 6;7 8 9];
B = A+A'
ishermitian(B)
B =
2.000 6.000 10.00
6.000 10.00 14.00
10.00 14.00 18.00
ans =
1
A is skew Hermitian.A = [1 2 3;4 5 6;7 8 9]+[1 2 3;4 5 6;7 8 9] * i;
A(1,1) = 0; A(2,2) = 0; A(3,3) = 0;
A(1,2) = -conj(A(2,1));
A(1,3) = -conj(A(3,1));
A(2,3) = -conj(A(3,2))
ishermitian(A,'skew')
A =
0.0000 + 0.0000i -4.0000 + 4.0000i -7.0000 + 7.0000i
4.0000 + 4.0000i 0.0000 + 0.0000i -8.0000 + 8.0000i
7.0000 + 7.0000i 8.0000 + 8.0000i 0.0000 + 0.0000i
ans =
1