how to generate numbers randomly
11 次查看(过去 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!