how can I calculate the nautical direction angle from Cartesian x- and y-component of velocity

9 次查看(过去 30 天)
I have a set of Cartesian x- (u) and y-component (v) of velocity. But I want the velocity to be Nautical direction based, which I did the follows:
for k=1:length(u)
if u(k) > 0 && v(k) >0 % velocity direction is from southwest and pointing towards northeast
dir(k) = 180+rad2deg(atan(abs(u(k))./abs(v(k))));
elseif u(k) < 0 && v(k) >0
dir(k) = 180-rad2deg(atan(abs(u(k))./abs(v(k))));
elseif u(k) < 0 && v(k) <0
dir(k) = rad2deg(atan(abs(u(k))./abs(v(k))));
else
dir(k) = 360-rad2deg(atan(abs(u(k))./abs(v(k))));
end
end
May I know if my understanding is conceptually correct?
  3 个评论
jie hu
jie hu 2023-12-27
移动:Dyuman Joshi 2023-12-27
thanks, But I am talking about the direction in Nautical convention. for y1 = atan2d(10, 10) = 45, shall that angle be 225 in Nautical convention?

请先登录,再进行评论。

回答(1 个)

Chunru
Chunru 2023-12-27
编辑:Chunru 2023-12-27
vx = 10;
vy = 10;
v = sqrt(vx.^2 + vy.^2)
v = 14.1421
theta = wrapTo360(90 - rad2deg(atan2(vy, vx))) % Earth coordinates, with ref to North, Clock wise
theta = 45
  5 个评论
Chunru
Chunru 2023-12-27
In nautical navigation the absolute bearing is the clockwise angle between north and an object observed from the vessel. https://en.wikipedia.org/wiki/Bearing_(angle)
The wind direction is defined as the direction from which the wind originates (the opposite of the wind velocity vector).

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Earth, Ocean, and Atmospheric Sciences 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by