rands
Random symmetric matrix.
Syntax
Section titled “Syntax”r = rands(n)r = rands(n, classname)Description
Section titled “Description”Returns an n×n symmetric matrix whose upper triangle is filled with uniform [0, 1] samples and whose lower triangle mirrors it. Useful as test data for symmetric-matrix algorithms (eigendecomposition, Cholesky, etc.).
Examples
Section titled “Examples”rands(4) % 4×4 symmetric uniform matrixisequal(rands(5), rands(5)') % 1 (always symmetric)