Here is what the matrix would look like:
There are 8 columns and say 100 rows, the random numbers in any row sum to 1.
.125 .125 .125 .125 ……. .125
.005 .105 .005 .205 ……. .205
.002 .003 .012. 201 ……. .200
…
Could Matlab automatically creates this kind of matrix, i.e. a right stochastic matrix? I am looking for a script.
Use
bsxfunrather thanrepmat: