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

📄 rvtolatlong.m

📁 衛星軌道運算可算出課譜樂六元素的一個好程式
💻 M
字号:
%orbit radius velocity latitude longitude ECEF
% Richard Rieber
% October 17, 2006
% rrieber@gmail.com
%
% Revision 8/21/07: Added H1 line for lookfor functionality.
%
% [Lat, Long] = RVtoLatLong(ECEF, GMST)
%
% Revision 9/25/07 - Fixed typo referring to velocity in comments.
%                    Velocity not needed in this function.
%
% Purpose:  This fuction convertes ECEF coordinates to Geocentric latitude
%           and longitude given ECEF radius in km and and Greenwich Mean
%           Sidereal Time (GMST).  Valid for any planetary body.
%
% Inputs:  o ECEF - A 3x1 vector of Earth Centered Earth Fixed (IJK)
%                   coordinates in km.
%          o GMST - A 1x1 input of the Greenwich Mean Sidereal Time
%                   in radians
%
% Outputs: o Lat - Geocentic latitude of spacecraft in radians
%          o Long - Longitude of spacecraft in radians
%

function [Lat, Long] = RVtoLatLong(ECEF, GMST)

if nargin < 2
    error('Too few inputs.  See help RVtoLatLong')
elseif nargin > 3
    error('Too many inputs.  See help RVtoLatLong')
end

if length(ECEF) ~= 3
    error('ECEF length incorrect.  See help RVtoLatLong')
end
if nargout ~= 2
    error('Incorrect number of outputs.  See help RVtoLatLong')
end

r_delta = norm(ECEF(1:2));

sinA = ECEF(2)/r_delta;
cosA = ECEF(1)/r_delta;

Long = atan2(sinA,cosA);

if Long < -pi
    Long = Long + 2*pi;
end

Lat = asin(ECEF(3)/norm(ECEF));

⌨️ 快捷键说明

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