How to plot multiple circles within a circle by using a for-loop for radius/center position?
Afficher commentaires plus anciens
Hi,
I want to plot multiple equisized small circles filling within a sector bigger circle.
The center of each of the smaller circle changes as radial distance with respect to the center of bigger cirlce, as can be seen from the attached image. And the smaller circles are to be filled with color map, ranging from 0 to 1.
This entire plotting will then be in a time loop from 1 to 100 sec.
It will be of great help if anyone can share thoughts, and if possible, brief code.
Thanks!
Sandeep
1 commentaire
Sandeep Kumar
le 28 Sep 2021
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 27 Sep 2021
If you have a list of the centers and radii, and the Image Processing Toolbox, I'd simply use the function meant for displaying circles: viscircles()
viscircles(centers, radii);
Lots of options you can use to change the way the circles look (color, linewidth, etc.), so look into those.
4 commentaires
Sandeep Kumar
le 28 Sep 2021
Image Analyst
le 29 Sep 2021
- Not with viscircles(). There is no masking feature for that function. You'd have to do the masking yourself by manually drawing the arcs.
- Not with viscircles(). You'd have to create a digital RGB image and then you could synthesize such an image.
Sandeep Kumar
le 29 Sep 2021
Image Analyst
le 29 Sep 2021
To plot an arc, see the FAQ:
You'd have to figure out the starting and stopping angle. That part is not MATLAB - it's just pure 10th grade math/geometry so I'm sure you can do it. Worst case you can plot just a point and a time and check if the point is farther away or closer from the containing circle's center than the containing circle's radius. Plot a dot if it's closer and don't plot a dot if it's farther away. Use sqrt() to get the Euclidean distance using the Pythagorean theorem.
Catégories
En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!