issymmetric
Tests whether a matrix is symmetric or skew-symmetric.
Category: Mathematics > Linear Algebra
Syntax
tf = issymmetric(A)
True if A equals its transpose A.'.
tf = issymmetric(A, 'skew')
True if A equals -A.'.
tf = issymmetric(A, tol)
Accepts a relative difference up to tol.
Description
Symmetry refers to the plain transpose, not the conjugate transpose, so [1 1i; 1i 2] is symmetric but not Hermitian. A skew-symmetric matrix must have a zero diagonal. The default comparison is exact; use a tolerance for matrices computed with rounding.
Input arguments
A- Square numeric matrix.
tol- Non-negative tolerance, default 0.
Output arguments
tf- Logical scalar.
Example
Symmetric, skew and tolerance
issymmetric([1 2; 2 3])
issymmetric([0 1; -1 0])
issymmetric([0 1; -1 0], 'skew')
issymmetric([1 2; 2.0001 3], 0.001)
Output
ans = logical
1
ans = logical
0
ans = logical
1
ans = logical
0