Drawing a circle with known radius

16 vues (au cours des 30 derniers jours)
Row Sarox
Row Sarox le 17 Avr 2022
Commenté : Image Analyst le 17 Avr 2022
How can i create a circle shape including 100 circles with known radius. Labeled with 4 different colors.

Réponse acceptée

KSSV
KSSV le 17 Avr 2022
Modifié(e) : KSSV le 17 Avr 2022
th = linspace(0,2*pi)' ;
R = 1;
x = R*cos(th) ;
y = R*sin(th) ;
% make groups
G = zeros(size(th)) ;
G(th >= 0 & th < pi/2) =1 ;
G(th>=pi/2 & th < pi) = 2 ;
G(th>=pi & th < 3*pi/2) = 3 ;
G(th >=3*pi/2 & th < 0) = 4 ;
gscatter(x,y,G,'bmgr','o')
axis equal
  2 commentaires
Row Sarox
Row Sarox le 17 Avr 2022
Thanks, i have been struggling to change the colors.
Image Analyst
Image Analyst le 17 Avr 2022
There is also a function called viscircles() you might want to know about.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by