llh2ecef.m

来自「UAV 自动驾驶的」· M 代码 · 共 20 行

M
20
字号
function [X,Y,Z]=llh2ecef(lat,long,alt)%   This function will convert latitude, longitude, and % altitude.  Lat and long are in degrees with -lat=south% of equator; -long=west of PM; altitude is % in meters.  Return on this function is X,Y,Z in ECEF % coordinates.  The dimentions are in meters.  Based on WGS-84% lat/long informtion.% [X,Y,Z]=llh2ecef(lat,long,alt)a=6378137.0; %mb=6356752.3142; %mf=(a-b)/a;e=sqrt(2*f-f^2);N=a/sqrt(1-e^2*sin(lat*pi/180)^2);Z=(N*(1-e^2)+alt)*sin(lat*pi/180);X=(N+alt)*cos(lat*pi/180)*cos(long*pi/180);Y=(N+alt)*cos(lat*pi/180)*sin(long*pi/180);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?