How to create a vector that assembles 30000 sets of parameters at random from the specified ranges
이전 댓글 표시
Hello,
I'm trying create a vector that assembles 30000 sets of parameters at random from the specified ranges.
I have a total of 30 parameters and each parameter values will be randomly selected from the specified ranges.
My initial code is something alone the line below;
par1 = 0.01+(0.2-0.01).*rand(30000,1); %when min=0.01 and max=0.2
par2 = 0.1+(0.5-0.1).*rand(30000,1); %when min=0.1 and max=0.5
% repeat this until par30
par = [par1 par2 par30]
Instead of doing this, is there a more efficient way to write the code? maybe using loop?
Thank you in advance,
댓글 수: 3
We only have 1 sample of the pattern which is not enough to confirm that we've guessed the pattern correctly.
How are the bounds defined for par1:par30? Is the rule that the low bound keeps getting multiplied by 10? What's the rule of the high bound?
In addition to the bounds, why is par1 adding 0.01 and then par2 is adding 0.1?
Lots if critical details missing.
Jung
2019년 10월 22일
Adam Danz
2019년 10월 22일
Ah, I see. I thought you wanted to automate the bounds as well. That would be fairly easy to do if there were a pattern.
I suggest making a simple local function where you just need to enter the bounds and the number of random samples you want. Then you just need to call that function for each param. See answer.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!