matlab 计算坐标方位角
function[distance,azimuth]=xy_inv(x1,y1,x2,y2)dx=x2-x1;dy=y2-y1;distance=sqrt(dx.^2+d...
function [distance,azimuth] = xy_inv(x1,y1,x2,y2)
dx=x2-x1;
dy=y2-y1;
distance=sqrt(dx.^2+dy.^2);
azimuth=atan2(dy,dx); if dx<0
azimuth=azimuth+pi;
else if dy<0
azimuth=azimuth+2*pi;
end
end
其中
x1(m) y1(m) x2(m) y2(m)
100.0000 100.0000 131.3417 113.5366
234.3100 678.2300 202.0421 922.6694
2345.2300 7624.5400 2033.4852 7409.2317
98.1000 73.3000 156.8511 6.0748
为什么输出的方位角还会有负数呢? 展开
dx=x2-x1;
dy=y2-y1;
distance=sqrt(dx.^2+dy.^2);
azimuth=atan2(dy,dx); if dx<0
azimuth=azimuth+pi;
else if dy<0
azimuth=azimuth+2*pi;
end
end
其中
x1(m) y1(m) x2(m) y2(m)
100.0000 100.0000 131.3417 113.5366
234.3100 678.2300 202.0421 922.6694
2345.2300 7624.5400 2033.4852 7409.2317
98.1000 73.3000 156.8511 6.0748
为什么输出的方位角还会有负数呢? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询