http://www.mathworks.com/matlabcentral/newsreader/view_thread/294982
MATLAB Central Newsreader  creating a random matrix based on a set of specifications
Feed for thread: creating a random matrix based on a set of specifications
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Thu, 28 Oct 2010 01:59:04 +0000
creating a random matrix based on a set of specifications
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294982#791223
John
Any ideas how i can write a program to create a symmetic nxn matrix with all entries being postive integers, zeros on the diagonal, all the row sums add up to a number S, and the rank is equal to n1.

Thu, 28 Oct 2010 07:54:04 +0000
Re: creating a random matrix based on a set of specifications
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294982#791276
Roger Stafford
"John " <hondacivic0606@yahoo.com> wrote in message <iaald8$71f$1@fred.mathworks.com>...<br>
> Any ideas how i can write a program to create a symmetic nxn matrix with all entries being postive integers, zeros on the diagonal, all the row sums add up to a number S, and the rank is equal to n1.<br>
          <br>
I'll do your problem for n equal to 4. I'm too sleepy for now to attempt a general solution. S must be an even integer greater than or equal to 4, otherwise there is no solution for n = 4.<br>
<br>
a = S/2;<br>
b = ceil((a1)*rand);<br>
c = ab;<br>
M = [0,a,b,c;a,0,c,b;b,c,0,a;c,b,a,0];<br>
p = randperm(4);<br>
M = M(p,p);<br>
<br>
Roger Stafford

Fri, 29 Oct 2010 02:03:04 +0000
Re: creating a random matrix based on a set of specifications
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294982#791542
John
Thanks !! could u explain how i would do a 10X10 and 8X8

Fri, 29 Oct 2010 05:55:05 +0000
Re: creating a random matrix based on a set of specifications
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294982#791576
Roger Stafford
"John " <hondacivic0606@yahoo.com> wrote in message <iada0o$c83$1@fred.mathworks.com>...<br>
> Thanks !! could u explain how i would do a 10X10 and 8X8<br>
         <br>
I'm afraid not as yet, John. I wasn't even able to solve the 5 x 5 problem after working on it for a while today. The general problem seems like a difficult one. The hard part of the problem is making the rank of the matrix n1. Otherwise it would be easy to generate solutions.<br>
<br>
Perhaps it would help if you would explain the background behind this problem, including why you need to have the matrix singular. That might set some new ideas in motion.<br>
<br>
Roger Stafford