Info

This question is closed. Reopen it to edit or answer.

How to distribute allredy generated random Number

1 view (last 30 days)
Sara Shafiee
Sara Shafiee on 21 Jul 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi,
I've already generated 250 random numbers with log normal distribution between 3 and 200 in matlab. Now I should classificate (I mean distribute) these numbers into 6 Part(Group), 3 part(Group) for values lower and equal 20 and 3 part for values upper than 20. But they should be distributed uniformly (equally) -- equally -- I mean it shouldn't, for example, all number near to 20 collected into one group, and in other all values near 3. they should be so distributed that if we represent with histogram come for each one like normal, or log normal, distribution out.
  2 Comments
dpb
dpb on 21 Jul 2019
Doesn't make any sense to me...how can you separate a group that are <20 and then not have the other group also include some that are not those smaller?
Need a better explanation of what you're trying to accomplish with, perhaps, an example using just 20 random variates illustrating might help.
Image Analyst
Image Analyst on 21 Jul 2019
Edited: Image Analyst on 21 Jul 2019
I agree the explanation is confusing and contradictory. How can the numbers be distributed both log normally and uniformly? Do you simply want to divide your set up into 6 groups, which should all have roughly the same distribution, like:
sortedNumbers = sort(yourNumbers, 'ascend');
group1 = sortedNumbers(1:6:end);
group2 = sortedNumbers(2:6:end);
group3 = sortedNumbers(3:6:end);
group4 = sortedNumbers(4:6:end);
group5 = sortedNumbers(5:6:end);
group6 = sortedNumbers(6:6:end);
This will be slightly biased. There is a way to do it unbiased by making a 2-D matrix out of your numbers, and randomly picking a column from each row for each of the groups, but it's more code, especially since 250 is not a multiple of 6.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!