⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xrinexn.m

📁 GPS TOOLBOX包含以下内容: 1、GPS相关常量和转换因子; 2、角度变换; 3、坐标系转换: &#61656 点变换; &#61656 矩阵变换; &#61656 向量变换
💻 M
字号:
%                                xrinexn.m
% Scope:   This Matlab program reads a RINEX 2 navigation message file and 
%          writes the data into three files; one output file contains the 
%          complete navigation information, while the other output files
%          contain the reduced ephemeris and almanac data.
% Usage:   xrinexn  
% Inputs:  - name of the ephemeris data file, RINEX 2 navigation message file
%          - name of the output file containing all navigation data information
%          - name of the output file containing reduced ephemeris data 
%          - name of the output file containing reduced almanac data 
% Outputs: - file containing all navigation data information; each record 
%            includes the data in the same order as the input file
%          - file containing the reduced ephemeris data; each record includes 
%            the following data: svprn,toe,smaxis,ecc,i0,Omega0,omega,M0,
%            Omegadot,deltan,idot,cic,cis,crc,crs,cuc,cus
%          - file containing the reduced ephemeris data; each record includes 
%            the following data: svprn,toe,smaxis,ecc,i0,Omega0,omega,M0,
%            Omegadot
%  Remark: The reduced ephemeris and almanac data files can be used by macros
%          svpeph and svpalm, respectively; both files contain data only for
%          healthy satellites.
%  Last update:  04/22/00
%  Copyright (C) 1998-00 by LL Consulting. All Rights Reserved.

clear

%  Specify the name of the input/output file

disp('  ');
disp('Specify the name of the RINEX 2 navigation,   ');
finp = input('         e.g. rinexnav.99n --> ','s');
disp('  ');
fout = input('Specify the output filename for the complete data -->  ','s');
disp('  ');
fout1 = input('Specify the output filename for the reduced ephemeris -->  ','s');
disp('  ');
fout2 = input('Specify the output filename for the reduced almanac -->  ','s');
disp('  ');

finp = fopen(finp);

while 1			%  skip the headlines (8 rows)
   line = fgetl(finp);
   answer = findstr(line,'END OF HEADER');
   if  ~isempty(answer), break;  end
end

nrsat = 0;
while  ~feof(finp)
   line = fgetl(finp);	     
   svprn = str2num(line(1:2));
   year = str2num(line(3:5));
   month = str2num(line(6:8));
   day = str2num(line(9:11));
   hour = str2num(line(12:14));
   minute = str2num(line(15:17));
   second = str2num(line(18:22));
   af0 = str2num(line(23:41));
   af1 = str2num(line(42:60));
   af2 = str2num(line(61:79));
   line = fgetl(finp);	  
   iode = str2num(line(4:22));
   crs = str2num(line(23:41));
   deltan = str2num(line(42:60));
   M0 = str2num(line(61:79));
   line = fgetl(finp);	  
   cuc = str2num(line(4:22));
   ecc = str2num(line(23:41));
   cus = str2num(line(42:60));
   roota = str2num(line(61:79));
   line = fgetl(finp);
   toe = str2num(line(4:22));
   cic = str2num(line(23:41));
   Omega0 = str2num(line(42:60));
   cis = str2num(line(61:79));
   line = fgetl(finp);	  
   i0 =  str2num(line(4:22));
   crc = str2num(line(23:41));
   omega = str2num(line(42:60));
   Omegadot = str2num(line(61:79));
   line = fgetl(finp);	  
   idot = str2num(line(4:22));
   codes = str2num(line(23:41));
   weekno = str2num(line(42:60));
   L2flag = str2num(line(61:79));
   line = fgetl(finp);	  
   svaccur = str2num(line(4:22));
   svhealth = str2num(line(23:41));
   tgd = str2num(line(42:60));
   iodc = str2num(line(61:79));
   line = fgetl(finp);	  
   tom = str2num(line(4:22));

   nrsat = nrsat + 1;

%  Save the complete data set available   

   fprintf(fout,'%2.0f %3.0f %3.0f %3.0f %3.0f %3.0f %5.1f ', ...
                 svprn,year,month,day,hour,minute,second);
   fprintf(fout,'%19.12e %19.12e %19.12e ',af0,af1,af2);
   fprintf(fout,'%19.12e %19.12e %19.12e %19.12e ',iode,crs,deltan,M0);
   fprintf(fout,'%19.12e %19.12e %19.12e %19.12e ',cuc,ecc,cus,roota);
   fprintf(fout,'%19.12e %19.12e %19.12e %19.12e ',toe,cic,Omega0,cis);
   fprintf(fout,'%19.12e %19.12e %19.12e %19.12e ',i0,crc,omega,Omegadot);
   fprintf(fout,'%19.12e %19.12e %19.12e %19.12e ',idot,codes,weekno,L2flag);
   fprintf(fout,'%19.12e %19.12e %19.12e %19.12e ',svaccur,svhealth,tgd,iodc);
   fprintf(fout,'%19.12e\n',tom);

   if  (svhealth == 0)
      smaxis = roota * roota;

%     Save the reduced data set to be used by macro svpeph 
   
      fprintf(fout1,'%3d %16.9e %16.9e %16.9e %16.9e ',svprn,toe,smaxis,ecc,i0);
      fprintf(fout1,'%16.9e %16.9e %16.9e %16.9e ',Omega0,omega,M0,Omegadot);
      fprintf(fout1,'%16.9e %16.9e %16.9e %16.9e ',deltan,idot,cic,cis);
      fprintf(fout1,'%16.9e %16.9e %16.9e %16.9e\n',crc,crs,cuc,cus);

%  Save the reduced data set to be used by macro svpalm 
   
      fprintf(fout2,'%3d %16.9e %16.9e %16.9e %16.9e ',svprn,toe,smaxis,ecc,i0);
      fprintf(fout2,'%16.9e %16.9e %16.9e %16.9e\n',Omega0,omega,M0,Omegadot);
   end

end

fprintf('Number of satellites = %2d\n\n',nrsat);
fclose all;
disp('End of the program  XRINEXN ');
disp('  ');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -