Grab polar intersection point coordinates from a plot
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lorenzo Lellini
el 22 de Dic. de 2022
Comentada: Star Strider
el 24 de Dic. de 2022
This code that plots a certain amount of circumferences and radiuses (separated by a given angle).
I need to find all the interesection points coordinates between radius and circumferences in polar and cartesian coordinates.
I should create vectors to store all the intersection coordinates for each radius.
Have you any idea about what I can do?
clear all
close all
clc
R=50; %circ radius
S=20; %num circ.lines
N=16; %num ang.lines
sect_width=2*pi/N;
sections_angle = rad2deg(sect_width);
offset_angle=0:sect_width:2*pi-sect_width;
%------------------
r=linspace(0,R,S+1);
w=0:.01:2*pi;
figure(1)
hold on
axis equal
grid minor
% plot circumferences
for n=2:length(r)
plot(real(r(n)*exp(1i*w)),imag(r(n)*exp(1i*w)),'k')
end
% plot radius
for n=1:length(offset_angle)
plot(real([0 R]*exp(1i*offset_angle(n))),imag([0 R]*exp(1i*offset_angle(n))),'k', 'LineWidth',1.2)
end
0 comentarios
Respuesta aceptada
Star Strider
el 23 de Dic. de 2022
The intersections can be calculated directly from the information provided in the code.
R=50; %circ radius
S=20; %num circ.lines
N=16; %num ang.lines
sect_width=2*pi/N;
sections_angle = rad2deg(sect_width);
offset_angle=0:sect_width:2*pi-sect_width;
%------------------
r=linspace(0,R,S+1);
w=0:.01:2*pi;
figure(1)
hold on
axis equal
grid minor
% plot circumferences
for n=2:length(r)
plot(real(r(n)*exp(1i*w)),imag(r(n)*exp(1i*w)),'k')
end
% plot radius
for n=1:length(offset_angle)
plot(real([0 R]*exp(1i*offset_angle(n))),imag([0 R]*exp(1i*offset_angle(n))),'k', 'LineWidth',1.2)
end
xisx = r(:)*cos(offset_angle); % X-Coordinates Of Intersections
yisx = r(:)*sin(offset_angle); % Y-Coordinates Of Intersections
plot(xisx, yisx, 'sg', 'MarkerSize', 3, 'MarkerFaceColor','g') % Plot Intersections (Cartesian)
hold off
[angisx,radisx] = cart2pol(xisx, yisx); % Polar Coordinates Of Interseections
Intersections = table(xisx(:), yisx(:), angisx(:), radisx(:), 'VariableNames',{'X','Y','Angle','Radius'})
.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Polar Plots 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!