?? tecefgd2.m
字號:
% tecefgd2.m
% Scope: This MATLAB macro performs the transformation from ECEF to geodetic
% coordinates for a given position by using an iterative process;
% WGS-84 constants are used.
% Usage: [lat,lon,alt] = tecefgd2(pecef)
% Description of parameters:
% pecef - input, ECEF position, with components in meters
% lat - output, latitude of the position, in radians
% lon - output, longitude of the position, in radians
% alt - output, altitude of the position, in meters
% External Matlab macros used: wgs84con
% Last update: 11/05/99
% Copyright (C) 1999 by LL Consulting. All Rights Reserved.
function [lat,lon,alt] = tecefgd2(pecef)
wgs84con;
% global constants used: a_smaxis, eccentr2, onemecc2
% Initialization
tol = 0.01;
alt = 0.;
rn = a_smaxis;
% Compute geodetic position
temp0 = sqrt(pecef(1)*pecef(1) + pecef(2)*pecef(2));
temp1 = pecef(3) / temp0;
oldalt = 1000.;
iter = 0;
while ( (abs(oldalt - alt) > 0.001) & (iter < 10) )
iter = iter + 1;
oldalt = alt;
temp = temp1 * (rn + alt) / (rn*onemecc2 + alt);
temp2 = temp * temp;
sin2phi = temp2 / (temp2 + 1.);
rn = a_smaxis / sqrt( 1. - eccentr2 * sin2phi);
alt = temp0 * sqrt(1. + temp2) - rn;
end
lat = atan(temp);
lon = atan2(pecef(2) , pecef(1));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -