Identification of overlapping points
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mariam Shahab
am 18 Aug. 2022
Beantwortet: Image Analyst
am 18 Aug. 2022
Hi all,
I have the following code.
hold on
for r=10:5:24 % r is radius
circles(r,17,12); % using circles function
for i=1:1:20;
for j=1:1:20;
if mod(i,2)==1; % even case
if mod(j,2)==1; % odd case
plot(i,j, 'bo');
elseif mod(i,2)==0;
elseif mod(j,2)==0;
plot(i,j,"ro");
else
end
end
end
end
end
hold off
I have attached an image of the plot.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1101285/image.png)
I want only the small circles (red and blue points) overlapping with the larger circles to appear. Any advice on how this can be achived. Many thanks.
Below is the circles function code.
function [x, y] = circles(r,Cx,Cy)
theta=linspace(0,2*pi,200);
x=r*cos(theta)+Cx;
y=r*sin(theta)+Cy;
plot(x,y)
end
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 18 Aug. 2022
I'd try pdist2 to see when the centers of the small circles are within their radius of any of the points on the larger circles.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!