📄 xvtransf.m
字号:
% xvtransf.m
% Scope: This MATLAB program performs the following coordinate transforma-
% tion of a given vector and referenced point/angles (optional):
% 1) from ECEF to ENU coordinates
% 2) from ENU to ECEF coordinates
% 3) from ECEF to LLWA coordinates
% 4) from LLWA to ECEF coordinates
% 5) from ECEF to INS coordinates
% 6) from INS to ECEF coordinates
% 7) from ENU to LLWA coordinates
% 8) from LLWA to ENU coordinates
% 9) from LLWA to GPS body coordinates
% 10) from GPS body to LLWA coordinates
% 11) from ECEF to Geodetic
% 12) from Geodetic to ECEF
% 13) from ENU to Geodetic
% 14) from Geodetic to ENU
% 15) from ECEF to ECI coordinates
% 16) from ECI to ECEF coordinates
% 17) from ECEF WGS-84 to SGS-85 coordinates
% 18) from SGS-85 to ECEF WGS-84 coordinates
% 19) from ECEF WGS-84 to PZ-90 coordinates
% 20) from PZ-90 to ECEF WGS-84 coordinates
% WGS-84 constants are used.
% Usage: xvtransf
% Inputs: - name of the output file if selected (the default is the screen)
% - input data from the keyboard as follows:
% 1) For the ECEF/ENU to ENU/ECEF transformation:
% - input vector
% - reference latitude, in radians
% - reference latitude, in radians
% 2) For the ECEF/LLWA to LLWA/ECEF transformation:
% - input vector
% - reference latitude, in radians
% - reference longitude, in radians
% - reference wander azimuth angle, in radians
% 3) For the ECEF/INS to INS/ECEF transformation:
% - input vector
% - reference latitude, in radians
% - reference longitude, in radians
% - reference wander azimuth angle, in radians
% 4) For the ENU/LLWA to LLWA/ENU transformation:
% - input vector
% - reference wander azimuth angle, in radians
% 5) For the LLWA/GPS Body to GPS Body/LLWA transformation:
% - input vector
% - yaw angle, in radians
% - pitch angle, in radians
% - roll angle, in radians
% 6) For the ECEF/Geodetic to Geodetic/ECEF transformation:
% - input vector
% - reference latitude, in radians
% - reference longitude, in radians
% - reference altitude, in meters
% 7) For the ENU/Geodetic to Geodetic/ENU transformation:
% - input vector
% - reference latitude, in radians
% - reference longitude, in radians
% - reference altitude, in meters
% 8) For the ECEF/ECI to ECI/ECEF transformation:
% - input vector
% - time elapsed since reference time, in seconds
% 9) For the ECEF WGS-84/SGS-85 to SGS-85/ECEF WGS-84 transformation:
% - input vector
% 10) For the ECEF WGS-84/PZ-90 to PZ-90/ECEF WGS-84 transformation:
% - input vector
% Outputs: - input/output data stored into the specified output file or
% displayed on screen
% External Matlab macros used: vecefenu, venuecef, vecefllw, vllwecef,
% vecefins, vinsecef, venullw, vllwenu, vllwb, vbllw,
% vecefgd, vgdecef, venugd, vgdenu, vecefeci, veciecef, vecefs85,
% vs85ecef, vecefp90, vp90ecef, tecefgd, tgdecef, wgs84con
% Last update : 04/05/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
clear
yes = 'y';
answer = 'y';
disp(' ');
answer1 = input('Do you want to save the results? (y/n)[n] --> ','s');
disp(' ');
if (strcmp(answer1,yes) == 1)
f2 = input('Specify the output filename --> ','s');
disp(' ');
else
f2 = 1; % output to the screen
end
while (strcmp(answer,yes) == 1)
disp(' Select : 1 --> ECEF to ENU coordinates');
disp(' 2 --> ENU to ECEF coordinates');
disp(' 3 --> ECEF to LLWA coordinates');
disp(' 4 --> LLWA to ECEF coordinates');
disp(' 5 --> ECEF to INS coordinates');
disp(' 6 --> INS to ECEF coordinates');
disp(' 7 --> ENU to LLWA coordinates');
disp(' 8 --> LLWA to ENU coordinates');
disp(' 9 --> LLWA to GPS body coordinates');
disp(' 10 --> GPS body to LLWA coordinates');
disp(' 11 --> ECEF to Geodetic coordinates');
disp(' 12 --> Geodetic to ECEF coordinates');
disp(' 13 --> ENU to Geodetic coordinates');
disp(' 14 --> Geodetic to ENU coordinates');
disp(' 15 --> ECEF to ECI coordinates');
disp(' 16 --> ECI to ECEF coordinates');
disp(' 17 --> ECEF WGS-84 to SGS-85 coordinates');
disp(' 18 --> SGS-85 to ECEF WGS-84 coordinates');
disp(' 19 --> ECEF WGS-84 to PZ-90 coordinates');
disp(' 20 --> PZ-90 to ECEF WGS-84 coordinates');
disp(' ');
select = input('Make the selection --> ');
disp(' ');
if (select == 1) % ECEF to ENU Transformation
pecef(1) = input('Enter x-component of the input vector --> ');
pecef(2) = input('Enter y-component of the input vector --> ');
pecef(3) = input('Enter z-component of the input vector --> ');
lat = input('Enter reference latitude in radians --> ');
lon = input('Enter reference longitude in radians --> ');
% Determine the output vector
voutput = vecefenu(pecef,lat,lon);
% Save the results if the output file is specified or display on screen
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
fprintf(f2,'\n***** Input data *****\n');
fprintf(f2,' x_ecef = %20.12f\n',pecef(1));
fprintf(f2,' y_ecef = %20.12f\n',pecef(2));
fprintf(f2,' z_ecef = %20.12f\n',pecef(3));
fprintf(f2,' latitude (rad.) = %20.12f\n',lat);
fprintf(f2,' longitude (rad.) = %20.12f\n',lon);
fprintf(f2,'\n***** Output ENU vector *****\n');
fprintf(f2,' x_enu = %20.12f\n',voutput(1));
fprintf(f2,' y_enu = %20.12f\n',voutput(2));
fprintf(f2,' z_enu = %20.12f\n',voutput(3));
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
elseif (select == 2) % ENU to ECEF Transformation
penu(1) = input('Enter x-component of the input vector --> ');
penu(2) = input('Enter y-component of the input vector --> ');
penu(3) = input('Enter z-component of the input vector --> ');
lat = input('Enter reference latitude in radians --> ');
lon = input('Enter reference longitude in radians --> ');
% Determine the output vector
voutput = venuecef(penu,lat,lon);
% Save the results if the output file is specified or display on screen
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
fprintf(f2,'\n***** Input data *****\n');
fprintf(f2,' x_enu = %20.12f\n',penu(1));
fprintf(f2,' y_enu = %20.12f\n',penu(2));
fprintf(f2,' z_enu = %20.12f\n',penu(3));
fprintf(f2,' latitude (rad.) = %20.12f\n',lat);
fprintf(f2,' longitude (rad.) = %20.12f\n',lon);
fprintf(f2,'\n***** Output ECEF vector *****\n');
fprintf(f2,' x_ecef = %20.12f\n',voutput(1));
fprintf(f2,' y_ecef = %20.12f\n',voutput(2));
fprintf(f2,' z_ecef = %20.12f\n',voutput(3));
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
elseif (select == 3) % ECEF to LLWA Transformation
pecef(1) = input('Enter x-component of the input vector --> ');
pecef(2) = input('Enter y-component of the input vector --> ');
pecef(3) = input('Enter z-component of the input vector --> ');
lat = input('Enter reference latitude in radians --> ');
lon = input('Enter reference longitude in radians --> ');
waz = input('Enter reference wander azimuth angle in radians --> ');
% Determine the output vector
voutput = vecefllw(pecef,lat,lon,waz);
% Save the results if the output file is specified or display on screen
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
fprintf(f2,'\n***** Input data *****\n');
fprintf(f2,' x_ecef = %20.12f\n',pecef(1));
fprintf(f2,' y_ecef = %20.12f\n',pecef(2));
fprintf(f2,' z_ecef = %20.12f\n',pecef(3));
fprintf(f2,' latitude (rad.) = %20.12f\n',lat);
fprintf(f2,' longitude (rad.) = %20.12f\n',lon);
fprintf(f2,' wander azimuth (rad.) = %20.12f\n',waz);
fprintf(f2,'\n***** Output LLWA vector *****\n');
fprintf(f2,' x_llw = %20.12f\n',voutput(1));
fprintf(f2,' y_llw = %20.12f\n',voutput(2));
fprintf(f2,' z_llw = %20.12f\n',voutput(3));
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
elseif (select == 4) % LLWA to ECEF Transformation
pllw(1) = input('Enter x-component of the input vector --> ');
pllw(2) = input('Enter y-component of the input vector --> ');
pllw(3) = input('Enter z-component of the input vector --> ');
lat = input('Enter reference latitude in radians --> ');
lon = input('Enter reference longitude in radians --> ');
waz = input('Enter reference wander azimuth angle in radians --> ');
% Determine the output vector
voutput = vllwecef(pllw,lat,lon,waz);
% Save the results if the output file is specified or display on screen
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
fprintf(f2,'\n***** Input data *****\n');
fprintf(f2,' x_llw = %20.12f\n',pllw(1));
fprintf(f2,' y_llw = %20.12f\n',pllw(2));
fprintf(f2,' z_llw = %20.12f\n',pllw(3));
fprintf(f2,' latitude (rad.) = %20.12f\n',lat);
fprintf(f2,' longitude (rad.) = %20.12f\n',lon);
fprintf(f2,' wander azimuth (rad.) = %20.12f\n',waz);
fprintf(f2,'\n***** Output ECEF vector *****\n');
fprintf(f2,' x_ecef = %20.12f\n',voutput(1));
fprintf(f2,' y_ecef = %20.12f\n',voutput(2));
fprintf(f2,' z_ecef = %20.12f\n',voutput(3));
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
elseif (select == 5) % ECEF to INS Transformation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -