📄 xreadalm.m
字号:
% xreadalm.m
% Scope: This MATLAB program reads almanac data from a Yuma format input
% file and stores the data into an ASCII data file (each record
% contains the data related to a satellite); a reduced almanac data
% set is stored into another file.
% Usage: xreadalm
% Inputs: - name of the Yuma format almanac input data file
% - name of the output data files (for the complete almanac and
% the reduced almanac used by the module svpalm.m)
% Outputs: - almanac data into the specified output files. For the complete
% almanac data each record contains the data related to a satellite
% in the following order:
% - satellite id number
% - satellite health
% - satellite eccentricity (e)
% - satellite time of applicability (toa), in seconds
% - satellite orbital inclination (I_0), in radians
% - satellite rate of right ascension (OMEGA_DOT), radians/second
% - satellite square root of semimajor axis (sqrt(a)), in meters^1/2
% - satellite right ascension at toa (OMEGA_0), in radians
% - satellite argument of perigee (omega), in radians
% - satellite mean anomaly (M_0), in radians
% - satellite af0, in seconds
% - satellite af1, in second/second
% - satellite week
% For the reduced almanac data each record contains the data related
% to a healthy satellite in the following order:
% - satellite id number
% - satellite time of applicability (toa), in seconds
% - satellite semimajor axis (a), in meters
% - satellite eccentricity (e)
% - satellite orbital inclination (I_0), in radians
% - satellite right ascension at toa (OMEGA_0), in radians
% - satellite argument of perigee (omega), in radians
% - satellite mean anomaly (M_0), in radians
% - satellite rate of right ascension (OMEGA_DOT), radians/second
% - number of satellites read (on screen)
% Last update: 12/29/00
% Copyright (C) 1998-00 by LL Consulting. All Rights Reserved.
clear
% Specify the name of the input/output files
disp(' ');
disp('Specify the Yuma format almanac input data file,');
fileinp = input(' e.g. wk749.yum --> ','s');
disp(' ');
fid = fopen(fileinp);
newline = fgetl(fid);
if ~strcmp(newline(1),'*')
error('XREADALM - file format error - start of file is not *');
end
% Select the output file names
disp('Specify the output filename for the complete almanac, ');
f2 = input(' e.g. wk749.alm for wk749.yum --> ','s');
disp(' ');
disp('Specify the output filename for the reduced almanac, ');
f3 = input(' e.g. wk749.dat for wk749.yum --> ','s');
disp(' ');
% Read and save input data
k = 0;
while ~feof(fid)
k = k + 1;
newline = fgetl(fid);
svid = str2num(newline(29:30));
newline = fgetl(fid);
svhealth = str2num(newline(29:31));
newline = fgetl(fid);
svecc = str2num(newline(29:44));
newline = fgetl(fid);
svtoa = str2num(newline(28:39));
newline = fgetl(fid);
svizero = str2num(newline(28:44));
newline = fgetl(fid);
svradot = str2num(newline(28:44));
newline = fgetl(fid);
svsqrta = str2num(newline(28:39));
newline = fgetl(fid);
svrazero = str2num(newline(28:44));
newline = fgetl(fid);
svargper = str2num(newline(28:44));
newline = fgetl(fid);
svmzero = str2num(newline(28:44));
newline = fgetl(fid);
svaf0 = str2num(newline(28:44));
newline = fgetl(fid);
svaf1 = str2num(newline(28:44));
newline = fgetl(fid);
svweek = str2num(newline(28:31));
newline = fgetl(fid);
newline = fgetl(fid);
% Save the complete alamanac data available
fprintf(f2,'%3.0f %3.0f %16.9e %16.9e %16.9e %16.9e %16.9e',...
svid,svhealth,svecc,svtoa,svizero,svradot,svsqrta);
fprintf(f2,'%16.9f %16.9f %16.9e %16.9e %16.9e %5.0f\n',...
svrazero,svargper,svmzero,svaf0,svaf1,svweek);
% Save the reduced almanac data used by module svpalm
if (svhealth == 0)
smaxis = svsqrta * svsqrta;
fprintf(f3,'%3d %16.9e %16.9e %16.9e %16.9e %16.9e %16.9e %16.9e %16.9e\n',...
svid,svtoa,smaxis,svecc,svizero,svrazero,svargper,svmzero,svradot);
end
end
status = fclose(fid);
fprintf('Number of satellites in the almanac = %3.0f\n\n',k);
disp('End of program XREADALM ');
disp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -