From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to genereate a n*n probality transition matrix
Date: Sat, 3 Apr 2010 03:46:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <hp6dlr$s75$>
References: <hp3lln$fka$> <hp64jp$2f2$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1270266363 28901 (3 Apr 2010 03:46:03 GMT)
NNTP-Posting-Date: Sat, 3 Apr 2010 03:46:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:623068

"Sadik " <> wrote in message <hp64jp$2f2$>...
> Hi Devanand,
> P = rand(n,n);
> rowSums = sum(P,2);
> normalizingMatrix = repmat(rowSums,1,n);
> P = P./normalizingMatrix;
> Now, sum(P,2) should give you a vector of ones [if I didn't make any typos :)].
> For each line, you can check the documentation by typing, say,
> doc repmat
> Best.

Hi Sadik,

  It should be realized that, as predicted at by the Central Limit Theorem of statistics, this kind of normalization will result in a distribution which is densest at the center of the n-1 dimensional simplex result and dropping down toward zero at its vertices, rather than a uniform distribution.

  Try plotting it with 'plot3' for n = 3.  All the points' yellow dots in the rows of P will fall in the two-dimensional equilateral space triangle outlined in red.  Observe that these dots are clustered most closely at the triangle's center and become noticeably sparser near its three vertices.

 P = rand(3000,3);
 rowSums = sum(P,2);
 normalizingMatrix = repmat(rowSums,1,3);
 P = P./normalizingMatrix;

Roger Stafford