Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Hend
Posts:
1
Registered:
5/6/13


Random Matrix help
Posted:
May 6, 2013 12:27 PM


I've never done any programming before so excuse me if what I'm asking is too simple to even be asked. I'm trying to construct a random nxn matrix that is symmetric and has entries of either 1 or 1 on the offdiagonals and 0s on the diagonal. Something tells me this is really easy but I can't figure it out.
I have this so far
n=5; A=rand(n); A=(A+A')/2; round(A)
But this only gives me entries of either 0 or 1 and I cannot figure out what to do to make the entries on the diagonal 0s.
Thanks.



