how to generate symmetric matrix with zero-one elements, complexity index of this matrix (number of ones / (size )^2) = any number from zero to 1 and diagonal equal ones

1 Ansicht (letzte 30 Tage)
how to generate symmetric matrix with zero-one elements, complexity index of this matrix (number of ones / (size )^2) = any number from zero to 1 and diagonal equal ones???
  1 Kommentar
Star Strider
Star Strider am 23 Jan. 2016
@Hayam — I thought you might be the only person who wanted the matrix, but it’s gotten several downloads in the 8 hours since I uploaded it!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 22 Jan. 2016
I have no idea if anyone else will ever use it, but it was intriguing enough as a problem for me to make it reasonably robust and put it up on the File Exchange. I’ll take it down eventually if it doesn’t generate any other interest.

Weitere Antworten (1)

Triveni
Triveni am 22 Jan. 2016
Bearbeitet: Triveni am 22 Jan. 2016
A = [1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5];
symmetry = [A, flip(A)];
if you need diagonal as ones use
B =diag(symmetry) ==ones;

Kategorien

Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by