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

2 次查看(过去 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???

采纳的回答

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;

类别

Help CenterFile Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by