Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
如何生成行数多于列数的随机矩阵?例如,行数是列数的倍数,例如10 columns 500 rows或20 columns 1000 rows等。
回答: 您可以使用诸如RAND和RANDI之类的功能来做这些事情。例如: nCols = randi([10 20]); %# A random integer between 10 and 20 nRows = nCols*50; %# Number of rows is a multiple of number of columns mat = rand(nRows,nCols); %# A matrix of random values between 0 and 1 更多&回答... |
![]() |
![]() |