Main Content

issymmetric

Determine if matrix is symmetric or skew-symmetric

Description

example

tf = issymmetric(A)returns logical1(真正) if square matrixAissymmetric; otherwise, it returns logical0(false).

example

tf = issymmetric(A,偏污染)specifies the type of the test. Specify偏污染as'skew'to determine ifAisskew-symmetric.

Examples

collapse all

Create a 3-by-3 matrix.

A = [1 0 1i; 0 1 0;-1i 0 1]
A =3×3 complex1.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 Hermitian and has a real-valued diagonal.

Test whether the matrix is symmetric.

tf = issymmetric(A)
tf =logical0

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

Change the element inA(3,1)to be1i.

A(3,1) = 1i;

Determine whether the modified matrix is symmetric.

tf = issymmetric(A)
tf =logical1

The matrix,A, is now symmetric because it is equal to its nonconjugate transpose,一种。'.

创建一个4×4矩阵。

A = [0 1 -2 5; -1 0 3 -4; 2 -3 0 6; -5 4 -6 0]
A =4×40 1 -2 5 -1 0 3 -4 2 -3 0 6 -5 4 -6 0

The matrix is real and has a diagonal of zeros.

Specify偏污染as'skew'to determine whether the matrix is skew-symmetric.

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

The matrix,A, is skew-symmetric since it is equal to the negation of its nonconjugate transpose,-A.'.

Input Arguments

collapse all

Input matrix, specified as a numeric matrix. IfA不是正方形,然后issymmetricreturns logical0(false).

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

Test type, specified as'nonskew'要么'skew'. Specify'skew'测试是否Aisskew-symmetric.

More About

collapse all

Symmetric Matrix

  • A square matrix,A, is symmetric if it is equal to its nonconjugate transpose,A = A.'.

    In terms of the matrix elements, this means that

    a i , j = a j , i .

  • 由于再保险al 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.

Skew-Symmetric Matrix

  • A square matrix,A, is skew-symmetric if it is equal to the negation of its nonconjugate transpose,a = -a。.

    In terms of the matrix elements, this means that

    a i , j = a j , i .

  • 由于再保险al 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-symmetric and skew-Hermitian.

Extended Capabilities

在R2014A介绍