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 回表示 (過去 30 日間)
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 件のコメント
Star Strider
Star Strider 2016 年 1 月 23 日
@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!

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2016 年 1 月 22 日
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.

その他の回答 (1 件)

Triveni
Triveni 2016 年 1 月 22 日
編集済み: Triveni 2016 年 1 月 22 日
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;
  1 件のコメント
Hayam Wahdan
Hayam Wahdan 2016 年 1 月 22 日
I need zero one matrix with number of ones = 0.7 ( any number from zero to one ) and oned in diagonal

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by