フィルターのクリア

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

5 ビュー (過去 30 日間)
Bradley
Bradley 2024 年 5 月 15 日
回答済み: Image Analyst 2024 年 5 月 15 日
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
Adam Danz 2024 年 5 月 15 日
編集済み: Adam Danz 2024 年 5 月 15 日
> 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')

その他の回答 (1 件)

Image Analyst
Image Analyst 2024 年 5 月 15 日

カテゴリ

Help Center および File ExchangeAntennas, Microphones, and Sonar Transducers についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by