how to generate numbers randomly
9 ビュー (過去 30 日間)
古いコメントを表示
i'm currently working on a project "Generation of varaiable SLL & variable beamwidth beams using GENETIC ALGORITHM using amplitude variation." here i need to generate amplitudes(excitations ) randomly. so., hw can i generate amplitudes randomly.
thanq in advance....
0 件のコメント
採用された回答
その他の回答 (3 件)
lucky yeggina
2011 年 3 月 6 日
1 件のコメント
Andrew Newell
2011 年 3 月 6 日
This should be a comment, not an Answer. What do you mean by "access"? MATLAB does lots of things with zeros.
Walter Roberson
2011 年 3 月 6 日
Are you trying to generate a random index in to an vector? If so, then
VectorIndices = ceil(length(TheVector) * rand(1,n));
0 件のコメント
Matt Tearle
2011 年 3 月 6 日
If you want indices, use randi to generate integers from 1 to n
idx = randi(length(x),7,1)
random7 = x(idx)
This samples with replacement. To shuffle an array use randperm
idx = randperm(length(x));
shufflex = x(idx);
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!