Borrar filtros
Borrar filtros

how to plot a section of a circle, need help with coding the math

8 visualizaciones (últimos 30 días)
I minored in math but for some reason its always been tough for me to figure out coding math. I have foward looking sonar data and im trying to plot a section of a circle around the sonar. I attached a picture of what im trying to plot. The variables I have is center position (lat and long), I have right and left aperture (130° total), max range (usually 25-30 m), and rotation (heading). How do I plot this section of a circle? Thanks!
Just to add, Im not sure which r is the radius being plotted, the heading data I have pertains to the middle r in the picture, if thats not the r determining direction of the circle then I could probably subtract direction from the left or right aperture angle? Thanks again.
Second edit:
I figured out how to plot the circle using a different block of code that i found but im having trouble understanding how things are plotted. Below is an image of using the correct radius, theta, orientation and a position of 0,0. What line is being plotted here? I plotted a frame of the sonar at the correct heading and its at a different angle from the triangle plotted below. Thanks again for your help!

Respuesta aceptada

Adam Danz
Adam Danz el 15 de Mayo de 2024
Editada: Adam Danz el 15 de Mayo de 2024
> The variables I have is center position (lat and long), I have right and left aperture (130° total), max range (usually 25-30 m), and rotation (heading). How do I plot this section of a circle?
I assume this is plotted in Cartesian coordinates and that the center point is defined by [latitude, longitude] which, in Cartesian coordinates, is [y,x].
center = [42.30027404055592, -71.35168003446316];
rightAp = 15; % deg
leftAp = 15; % deg
radius = 25; % max range
heading = 45; % deg
th = linspace(heading-leftAp, heading+rightAp, 100);
x = [center(2), sind(th) * radius + center(2), center(2)];
y = [center(1), cosd(th) * radius + center(1), center(1)];
plot(x,y, '-k');
axis equal
% Add reference line
hold on
plot([center(2), sind(heading)*radius+center(2)], ...
[center(1), sind(heading)*radius+center(1)], '--k')

Más respuestas (1)

Image Analyst
Image Analyst el 15 de Mayo de 2024

Categorías

Más información sobre Geographic Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by