⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tecefgd2.m

📁 Matlab GPS Toolbox
💻 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 + -