Info
This question is closed. Reopen it to edit or answer.
Generate randomly spaced circles of different diameters and output overlap
3 views (last 30 days)
Show older comments
So I'm kinda stuck on how to make a script that will output a square box (50x50), with a circle in the centre (d=5), which then has randomly spaced circles plotted of different diameters (0.5,1,2) also random.
The random circles need to make up 30% of the total area (doesn't matter if they overlap). I then need to output the amount of area overlap of random circles with the centre circle, how many circles overlap and what size. This is going to be iterated as a monte carlo simulation.
This is then going to be progressed into a 3D model but with a central cylinder and random spheres. Any tips on how to do that as well, is much appreciated.
1 Comment
John D'Errico
on 16 Jun 2018
Break a problem that is too large for you down into small pieces. Then solve each piece, one at a time. Here, first, think of how you define a circle, thus a center, and a radius.
What is the distribution of the centers? IF the distribution is uniform, do you know how to generate points uniformly in a square?
How about the radius? Do you know how to generate a random number?
If not, then why are you not reading the tutorials?
Can you generate one circle at a time, using a loop? Of course. You can do it all at once in one vectorized call, but so what? Generate them. Save them in an array of centers and radii.
So proceed from one step to the next. Given a set of circles, what is the overlap? Given one circle, can you compute the overlap with a single other circle? So then it is just a loop. Or, perhaps you can think of how to solve this problem approximately using image processing techniques.
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!