how to generate numbers randomly
이전 댓글 표시
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....
채택된 답변
추가 답변 (3개)
lucky yeggina
2011년 3월 6일
0 개 추천
댓글 수: 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));
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);
카테고리
도움말 센터 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!