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

8 views (last 30 days)
Answered: Image Analyst on 15 May 2024
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!

Adam Danz on 15 May 2024
Edited: Adam Danz on 15 May 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
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
hold on
Excellent, thank you!

Image Analyst on 15 May 2024

Categories

Find more on Geographic Plots in Help Center and File Exchange

R2023b

Community Treasure Hunt

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

Start Hunting!