![]() |
如何在MATLAB中生成大小可变的随机值矩阵?
如何生成行数多于列数的随机矩阵?例如,行数是列数的倍数,例如10 columns 500 rows或20 columns 1000 rows等。
[B]回答:[/B] 您可以使用诸如[URL="http://www.mathworks.com/help/techdoc/ref/rand.html"]RAND[/URL]和[URL="http://www.mathworks.com/help/techdoc/ref/randi.html"]RANDI之[/URL]类的功能来做这些事情。例如: 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 [url=https://stackoverflow.com/questions/5228738]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 10:55。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.