5x4 colored circle in a grid format

Respuestas (1)

KSSV
KSSV el 7 de Jul. de 2021
th = linspace(0,2*pi) ;
r = 0.1 ;
xc = r*cos(th) ;
yc = r*sin(th) ;
x = 1:5 ;
y = 1:4 ;
[X,Y] = meshgrid(x,y) ;
figure
hold on
for i = 1:4
for j = 1:5
patch(X(i,j)+xc,Y(i,j)+yc,rand(1,3))
end
end
Or
th = linspace(0,2*pi) ;
r = 0.1 ;
xc = r*cos(th) ;
yc = r*sin(th) ;
x = 1:5 ;
y = 1:4 ;
[X,Y] = meshgrid(x,y) ;
c = sqrt(X.^2+Y.^2) ;
scatter(X(:),Y(:),100,c(:),'filled')

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 7 de Jul. de 2021

Respondida:

el 7 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by