Path: news.mathworks.com!not-for-mail From: "saeed kamelian" <kamelian.20@gmail.com> Newsgroups: comp.soft-sys.matlab Subject: special matrix construction Date: Tue, 19 Jul 2011 15:22:09 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 41 Message-ID: <j047f1$lpi$1@newscl01ah.mathworks.com> Reply-To: "saeed kamelian" <kamelian.20@gmail.com> NNTP-Posting-Host: www-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1311088929 22322 172.30.248.47 (19 Jul 2011 15:22:09 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 19 Jul 2011 15:22:09 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2954849 Xref: news.mathworks.com comp.soft-sys.matlab:736735 Dear all I want to construct a matrix with some special properties. i call this matrix G so the G matrix has the following properties 1-the G matrix's element are all 1 or 0 2-the G matrix always have bigger number of rows than columns or at least equal to the number of columns (#rows>=#columns) 3-sum of all of elements of G(sum of all 1's) is equal to number of rows 4-sum of all elements in each row of G is equal to 1 5-there is at least one 1 in each column of G matrix. I want to have and list all of the possible case of G matrix with that stated properties. for example if we have 4 rows and 2 columns the all possible G matrix are like below: 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 0 1 (1) (2) (3) (4) 0 1 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 0 1 0 1 (5) (6) (7) (8) (9) (10) 0 1 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 0 1 (11) (12) (13) (14) these are all 14 possible case when number of rows is 4 and number of column is 2 how can i write a code for arbitrary number of rows and columns. i think total number of possible case can be calculated from the following formula m= number of rows n= number of columns n^m - ( n * (n-1)^m ) m=4 n=2 2^4 - (2*(2-1)^4))=14 regards