sprandsym
R = sprandsym (n, density) R = sprandsym (S) R = sprandsym (n, density, rc) R = sprandsym (n, density, rc, kind) Random sparse symmetric matrix with standard normal entries. With a vector rc of n eigenvalues the matrix has exactly that spectrum; with a scalar rc (and kind 1, 2 or 3) it is positive definite with condition number 1/rc.