distance.m

来自「卫星链路的计算」· M 代码 · 共 15 行

M
15
字号
function dis = distance(lon,lat)
% this function returns the distance from certain position to satllite
% the satellite(SINOSAT-2) is above point of intersection of 92.2°E and 
% the equator, orbit radius is 42164.6km, earth radius is 6378km.
% lon,lat: longitude and latitude of the earth station

Re = 6378.14;    % earth radius, km.
R = 42164.57;  % orbit radius, km.
lon0 = 92.2;  % longitude of the satellite
lat0 = 0;     % latitude of the satellite

dlon = (lon-lon0)*pi/180;   % delta longitude between satellite and earth sation
dlat = (lat-lat0)*pi/180;   % delta latitude between satellite and earth sation

dis = R*sqrt(1+(Re/R)^2-2*Re*cos(dlon)*cos(dlat)/R);

⌨️ 快捷键说明

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