![Screen Shot 2019-06-07 at 12.05.07 AM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/223475/Screen%20Shot%202019-06-07%20at%2012.05.07%20AM.png)
Randomly initialise a matrix with numbers between 0 and 1?
18 次查看(过去 30 天)
显示 更早的评论
I want to initialise a 2*5 matrix with values between 0 and 1. Is there any easy way to do this?
0 个评论
回答(1 个)
Manvi Goel
2019-6-6
You can initialise a random matrix with uniform distribution between 0 and 1 by the following:
randomMatrix = rand(2,5)
![Screen Shot 2019-06-07 at 12.05.07 AM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/223475/Screen%20Shot%202019-06-07%20at%2012.05.07%20AM.png)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!