![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/713012/image.jpeg)
create circular dot grids
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ELISABETTA BILLOTTA
el 16 de Ag. de 2021
Editada: Simon Chan
el 17 de Ag. de 2021
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/713007/image.jpeg)
I have the plot of the borders of the continents. how can i create circles like those in the picture? I have the latitude and longitude of the central point, the radius of the circumference, which would be a distance, and 10 points that would build the circumference that are 36 degrees apart from each other.
0 comentarios
Respuesta aceptada
Simon Chan
el 16 de Ag. de 2021
Editada: Simon Chan
el 16 de Ag. de 2021
Use function pol2cart
clear; clc;
separation = 36; % Angle separation
rhoA = 10; % Radius #1, 10 pixels
rhoB = 15; % Radius #2, 15 pixels
num_dot = 360/separation +1; % Total number of points
theta = linspace(-pi,pi,num_dot); % Theta separation
cx = 50; % Your center point, x-coordinates = 50 (example)
cy = 25; % Your center point, y-coordinates = 25 (example)
[xA,yA] = pol2cart(theta,rhoA); % Use pol2cart
[xB,yB] = pol2cart(theta,rhoB); % Use pol2cart
A = zeros(100,100); % Original region, example, size: 100x100
[Ny, Nx]= size(A);
xA_convert = round(cx-xA); % Convert back from polar coordinates
yA_convert = round(cy-yA);
xB_convert = round(cx-xB);
yB_convert = round(cy-yB);
for k = 1:num_dot
A(yA_convert(k),xA_convert(k)) =1; % Put the dots in matrix A (can skip this loop)
A(yB_convert(k),xB_convert(k)) =1;
end
plot(cx,cy,'ro'); % Your center point
hold on
plot(xA_convert,yA_convert,'b+')
plot(xB_convert,yB_convert,'g*')
xlim([0 Nx])
ylim([0 Ny])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/713012/image.jpeg)
3 comentarios
Simon Chan
el 17 de Ag. de 2021
Editada: Simon Chan
el 17 de Ag. de 2021
May use this function: latlon2local
Más respuestas (0)
Ver también
Categorías
Más información sobre Cartesian Coordinate System Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!