📄 xsvpalm.m
字号:
% xsvpalm.m
% Scope: This MATLAB program computes ECEF satellite position based on
% satellite almanac data; WGS-84 constants are used.
% Usage: xsvpalm
% Inputs: - tsim, GPS system time at time of transmission, i.e. GPS time
% corrected for transit time (range/speed of light), in seconds
% - satellite almanac data from a specified data file; default data
% are given. The almanac satellite data is specified in the
% following order (each record is for a different satellite):
% - satelitte number
% - toa, reference time almanac (toa, time of applicability), in seconds
% - smaxis, satellite semi-major axis (a), in meters
% - ecc, satellite eccentricity (e)
% - izero, inclination angle at reference time (I_0), in radians
% - razero, right ascension at reference time (OMEGA_0), in radians
% (longitude of ascending node of orbit plane at weekly epoch)
% - argper, argument of perigee (omega), in radians
% - mzero, mean anomaly at reference time (M_0), in radians
% - radot, rate of right ascension (OMEGA_DOT), in radians/second
% - name of the input data file (optional)
% - name of the output file (optional)
% Outputs: - input/output data stored on the selected output file or
% displayed on screen
% External Matlab macros used: svpalm, wgs84con
% Last update: 11/08/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
clear
yes = 'y';
% Specify the almanac data for the satellite
disp(' ');
answer1 = input('Do you want to use the default data? (y/n)[y] ','s');
if isempty(answer1)
answer1 = yes;
end
disp(' ');
svid = [];
if (strcmp(answer1,yes) == 1)
tsim = 238205.; % GPS system time at time of transmission,
% i.e. GPS time corrected for transit time
% (range/speed of light), in seconds
almanac(1) = 1; % default value
almanac(2) = 244800.; % reference time almanac (toa), in seconds
almanac(3) = 26560360.0409; % semi-major axis (a), in meters
almanac(4) = 0.00528036116157; % satellite eccentricity (e)
almanac(5) = 0.970306409202; % inclination angle at reference time (I_0),
% in radians
almanac(6) = -3.09805209344; % right ascension at reference time (OMEGA_0),
% in radians
almanac(7) = 2.88898057517; % argument of perigee (omega), in radians
almanac(8) = -0.784710884484; % mean anomaly at reference time (M_0), in
% radians
almanac(9) = -7.84889836669e-9; % rate of right ascension (OMEGA_DOT), in
% radians/second
nrow = 1;
else
tsim = input('Specify the tsim, e.g. 238205., --> ');
disp(' ');
fname = input('Specify the almanac data filename (with extension), e.g. wk749.dat --> ','s');
disp(' ');
almanac = load(fname);
[nrow,ncol] = size(almanac);
if ncol ~= 9
disp('XSVPALM - Error: check the input data (number of columns)');
disp(' ');
break;
end
end
% Select the output file
answer2 = input('Do you want to save the generated data? (y/n)[y] ','s');
if isempty(answer2)
answer2 = yes;
end
disp(' ');
if strcmp(answer2,yes) == 1
f2 = input('Specify the output filename --> ','s');
disp(' ');
else
f2 = 1; % output to the screen
end
fprintf(f2,'***************************************************************\n');
fprintf(f2,'\n*****Simulation time = %16.7e seconds\n',tsim);
for k = 1:nrow
svid(k) = almanac(k,1);
temp = almanac(k,2:9);
% Compute the ECEF satellite position
pse = svpalm(tsim,temp);
% Save the generated data into a specified file or displayed on screen
fprintf(f2,'\n*****Almanac data for satellite # %2.0f\n',svid(k));
fprintf(f2,'toa = %22.14e seconds\n',temp(1));
fprintf(f2,'smaxis = %22.14e meters\n',temp(2));
fprintf(f2,'ecc = %22.14e \n',temp(3));
fprintf(f2,'izero = %22.14e radians\n',temp(4));
fprintf(f2,'razero = %22.14e radians\n',temp(5));
fprintf(f2,'argper = %22.14e radians\n',temp(6));
fprintf(f2,'mzero = %22.14e radians\n',temp(7));
fprintf(f2,'radot = %22.14e radians/second\n\n',temp(8));
fprintf(f2,'ECEF position for satellite # %2.0f based on almanac data \n',...
svid(k));
fprintf(f2,'x-component = %22.14e meters\n',pse(1));
fprintf(f2,'y-component = %22.14e meters\n',pse(2));
fprintf(f2,'z-component = %22.14e meters\n\n',pse(3));
end
fprintf(f2,'***************************************************************\n');
disp(' ');
disp('End of the program XSVPALM ');
disp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -