📄 xecef2~1.m
字号:
% xecef2gd_comp.m
% Scope: This MATLAB program performs the comparison between two different
% algorithms implementing the ECEF to Geodetic coordinates
% transformation; WGS-84 constants are used.
% Usage: xecef2gd_comp
% Inputs: - name of the output file if selected (the default is the screen)
% - input data from the keyboard as follows:
% - x-component of the ECEF position, in meters
% - y-component of the ECEF position, in meters
% - z-component of the ECEF position, in meters
% The ECEF coordinates can be entered from keyboard or from a
% specified file (in this case the record contains the
% x, y, and z components)
% Outputs: - input/output data stored into the specified output file or
% displayed on screen
% External Matlab macros used: tecefgd, tecefgd2, wgs84con
% Last update: 05/08/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
clear
yes = '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
disp('Execute ECEF to Geodetic Transformation by using 2 different algorithms');
disp(' ');
ntrials = input('Enter number of trials, e.g. 1000, --> ');
disp(' ');
answer2 = input('Enter data from keyboard? (y/n)[n] --> ','s');
disp(' ');
if (strcmp(answer2,yes) == 1)
pecef(1) = input('Enter ECEF x-component in meters --> ');
pecef(2) = input('Enter ECEF y-component in meters --> ');
pecef(3) = input('Enter ECEF z-component in meters --> ');
disp(' ');
else
finp = input('Specify input filename --> ','s');
disp(' ');
% Read the input data file
pecef = load(finp);
[nrow,ncol] = size(tt);
if ncol ~= 3
error('Error - Xexef2gd_comp; check the input data file');
end
end
% Compute Geodetic coordinates by using macro tecefgd
tic;
for k = 1:ntrials
[lat1,lon1,alt1] = tecefgd(pecef);
end
etime1 = toc;
% Compute Geodetic coordinates by using macro tecefgd2
tic;
for k = 1:ntrials
[lat2,lon2,alt2] = tecefgd2(pecef);
end
etime2 = toc;
% Save the results if the output file is specified or display on screen
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
fprintf(f2,'\n***** ECEF coordinates *****\n');
fprintf(f2,' x - component y - component');
fprintf(f2,' z - component \n');
fprintf(f2,'%20.7f %20.7f %20.7f\n', pecef(1),pecef(2),pecef(3));
fprintf(f2,'\n***** Geodetic coordinates by using tecefgd *****\n');
fprintf(f2,' latitude (rad.) longitude (rad.)');
fprintf(f2,' altitude (m.) \n');
fprintf(f2,'%20.12f %20.12f %20.12f\n',lat1,lon1,alt1);
fprintf(f2,'Elapsed time = %20.12f seconds\n',etime1/ntrials);
fprintf(f2,'\n***** Geodetic coordinates by using tecefgd2 *****\n');
fprintf(f2,' latitude (rad.) longitude (rad.)');
fprintf(f2,' altitude (m.) \n');
fprintf(f2,'%20.12f %20.12f %20.12f\n',lat2,lon2,alt2);
fprintf(f2,'Elapsed time = %20.12f seconds\n',etime2/ntrials);
fprintf(f2,'\n**************************************************');
fprintf(f2,'******************************\n');
disp(' ');
disp('End of the program Xecef2gd_comp');
disp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -