Documentation

ishermitian

Determine if matrix is Hermitian or skew-Hermitian

Syntax

tf = ishermitian(A)
tf = ishermitian(A,skewOption)

Description

example

tf = ishermitian(A)returns logical1(true) if square matrixAisHermitian; otherwise, it returns logical0(false).

example

tf = ishermitian(A,skewOption)specifies the type of the test. SpecifyskewOptionas'skew'to determine ifAisskew-Hermitian.

Examples

collapse all

Create a 3-by-3 matrix.

A = [1 0 1i; 0 1 0; 1i 0 1]
A = 1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 1.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 1.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i

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

Test whether the matrix is Hermitian.

tf = ishermitian(A)
tf =logical0

The result is logical0(false) becauseAis not Hermitian. In this case,Ais equal to its transpose,A.', but not its complex conjugate transpose,一个“.

Change the element inA(3,1)to be-1i.

A(3,1) = -1i;

Determine if the modified matrix is Hermitian.

tf = ishermitian(A)
tf =logical1

The matrix,A, is now Hermitian because it is equal to its complex conjugate transpose,一个“.

Create a 3-by-3 matrix.

A = [-1i -1 1-i;1 -1i -1;-1-i 1 -1i]
A = 0.0000 - 1.0000i -1.0000 + 0.0000i 1.0000 - 1.0000i 1.0000 + 0.0000i 0.0000 - 1.0000i -1.0000 + 0.0000i -1.0000 - 1.0000i 1.0000 + 0.0000i 0.0000 - 1.0000i

The matrix has pure imaginary numbers on the main diagonal.

SpecifyskewOptionas'skew'to determine whether the matrix is skew-Hermitian.

tf = ishermitian(A,'skew')
tf =logical1

The matrix,A, is skew-Hermitian since it is equal to the negation of its complex conjugate transpose,-A'.

Input Arguments

collapse all

Input matrix, specified as a numeric matrix. IfAis not square, thenishermitianreturns logical0(false).

Data Types:single|double|logical
Complex Number Support:Yes

Test type, specified as'nonskew'or'skew'. Specify'skew'测试是否Aisskew-Hermitian.

More About

collapse all

Hermitian Matrix

  • A square matrix,A, is Hermitian if it is equal to its complex conjugate transpose,A = A'.

    In terms of the matrix elements, this means that

    a i , j = a ¯ j , i .

  • The entries on the diagonal of a Hermitian matrix are always real. Since real matrices are unaffected by complex conjugation, a real matrix that is symmetric is also Hermitian. For example, the matrix

    A = [ 1 0 0 2 1 0 1 0 1 ]

    is both symmetric and Hermitian.

  • The eigenvalues of a Hermitian matrix are real.

Skew-Hermitian Matrix

  • A square matrix,A, is skew-Hermitian if it is equal to the negation of its complex conjugate transpose,A = -A'.

    In terms of the matrix elements, this means that

    a i , j = a ¯ j , i .

  • The entries on the diagonal of a skew-Hermitian matrix are always pure imaginary or zero. Since real matrices are unaffected by complex conjugation, a real matrix that is skew-symmetric is also skew-Hermitian. For example, the matrix

    A = [ 0 1 1 0 ]

    is both skew-Hermitian and skew-symmetric.

  • The eigenvalues of a skew-Hermitian matrix are purely imaginary or zero.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2014a

Was this topic helpful?