www.pudn.com > ld.rar > JW2JZB.m, change:2008-12-23,size:1373b


function [Az Ra] = JW2JZB(jd,wd,JD_z,WD_z); %%经纬度转极坐标函数JD_z和JW_z表示站基点经纬度,jd和wd表示点的经纬度 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Degree = floor(JD_z); 
Min = floor(100*(JD_z - Degree)); 
Sec = 100*((JD_z*100) - floor(JD_z*100)); 
JD = Degree + Min/60 + Sec/3600;  
 
Degree = floor(WD_z); 
Min = floor(100*(WD_z - Degree)); 
Sec = 100*((WD_z*100) - floor(WD_z*100)); 
WD = Degree + Min/60 + Sec/3600; 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
[x0 y0] = Jw2zj(JD,WD); 
[x y] = Jw2zj(jd,wd); 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
relative_x = x - x0; 
relative_y = y - y0; 
if relative_x == 0 && relative_y >= 0; 
    Az = 0; 
elseif relative_x == 0 && relative_y < 0; 
    Az = 180; 
elseif relative_x > 0; 
    Az = 90 - atan( relative_y/relative_x )/pi*180; 
elseif relative_x < 0; 
    Az = 270 - atan( relative_y/relative_x )/pi*180; 
% elseif relative_x > 0 && relative_y >= 0; 
%     Az = 90 - atan( relative_y/relative_x )/pi*180; 
% elseif relative_x > 0 && relative_y < 0; 
%     Az = 90 - atan( relative_y/relative_x )/pi*180; 
% elseif relative_x < 0 && relative_y >= 0; 
%     Az = 270 - atan( relative_y/relative_x )/pi*180; 
% elseif relative_x < 0 && relative_y < 0; 
%     Az = 270 - atan( relative_y/relative_x )/pi*180; 
end 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Ra = sqrt( (x-x0)^2 + (y-y0)^2 ); 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%