random matrix
11 次查看(过去 30 天)
显示 更早的评论
I want to create 2 random matrixes (5x5). One where all the sums of the horizontal axis equal 1 and one where all the vertical axis equal to 1. Any help? Additionally all the random numbers should be ->x>1
0 个评论
回答(1 个)
Sean de Wolski
2011-4-13
x1 = rand(5);
x2 = rand(5);
x1 = bsxfun(@rdivide,x1,sum(x1,1));
x2 = bsxfun(@rdivide,x2,sum(x2,2));
1 个评论
Oleg Komarov
2011-4-13
I would suggest http://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum since a normalization doesn't guarantee uniformly random sets.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!