《GPS测量与数据处理(N文件)》实验(上机)报告
班级·学号 姓名实验 日期6月10号 任课教师 实验名称 实践型 一、实验目的及要求 1. 通过编程N文件,深入理解matlab编程方式与运行原理。 2..通过老师给定的N文件,看懂并在理解的基础上,加入自己的内容。 3.学习高级语言软件MATLAB. 二、实验平台 1.微机一台 2.matlab软件一套 三、实验内容 请写出实验内容的操作步骤(本表不够填写可加页): (请写出实验内容各环节的详细操作步骤(可附屏幕截图)和常用功能的实现代码清单) 三、实验内容 1.打开MATLAB程序及面如下图所示
2.打开已有的REND N RINEX 文件,并点击运行,运行成果如下(具体程序段见附录)。
3.通过本组编辑后的程序及运行结果如下(具体程序段见附录)。
◆已知程序 function EphDat = Read_N_Renix(filename) %Read the N-file with the renix format %Input: % filename: the name of file including the file path %Output: % EphDat: a structure, storing the ephemeris % .SatPRN; //the Sat code % % % % % % % % % % % % % % % .toc; //gpsweeksec .a0; //different of the sat clock(second) .a1; //sat clock drift (s/s) .a2; //the rate of the Sat clock drift(s/s^2) .IODE; //星历数据有效期IODE=Toe -Tl; .Crs; //轨道半径正弦调和改正项振幅(m) .DetaN; //平均运动修正量 .M0; //Toe时的平近点角 .Cuc; //纬度幅角余弦调和改正项振幅 .e; //卫星轨道扁心率 .Cus; //纬度幅角正弦调和改正项振幅 .sqrtA; //卫星轨道长半径方根 .Toe; //星历参考时间 .Cic; //轨道倾角余弦调和改正项振幅 .OMG0; //升交点赤经 % .Cis; //轨道倾角正弦调和改正项振幅 % .I0; //轨道倾角 % .Crc; //轨道半径余弦调和改正项振幅(m) % .omg; //近地点角距 % .OMG0dot; //升交点赤经变化率
% .I0dot; //轨道倾角变化率 % .ISL2; //L2 数据标志 % .GpsWn; //GPS week number % .ISL2P; //L2 P 数据标志 % .SatAccu; //The accuracy of the satellite(m) % .SatHth; //The health of the Satellite (MSB) % .Tgd; //单频接收机延迟改正数 % .IODC; //时钟数据有效期 ?gin program [filename,pathname]=uigetfile('*.**N','读取GPS广播星历文件'); fp=fopen(strcat(pathname,filename),'rt'); if(fp==-1) error('error to open the '+ filename); end %read the file header while (1) strTemp=fgets(fp); if(strTemp==-1) error('error in the header file of '+ filename); end if(length(strTemp)<73) strTemp(length(strTemp)+1:73)='X'; end if(strTemp(61:73)=='END OF HEADER') break; end end %read the N file data %read the first epoch strTemp=fgets(fp); EphDat(1).SatPRN=str2num(strTemp(1:2)); Year=str2num(strTemp(4:5));Mon=str2num(strTemp(7:8)); Day=str2num(strTemp(10:11));THour=str2num(strTemp(13:14)); TMin=str2num(strTemp(16:17));TSec=str2num(strTemp(19:22)); if (Year>80) %GPS从20C80年代上商用 Year=Year+1900; else Year=Year+2000; end EphDat(1).toc=ConvertGpsTime(Year,Mon,Day,THour,TMin,TSec); %转换成GPS周秒 EphDat(1).a0=str2num(strTemp(23:41)); %D,E需要转化。。。。。。。。。。 EphDat(1).a1=str2num(strTemp(42:60)); EphDat(1).a2=str2num(strTemp(61:79)); strTemp=fgets(fp);; %read the second line EphDat(1).IODE=str2num(strTemp(1:22)); EphDat(1).Crs=str2num(strTemp(23:41)); EphDat(1).DetaN=str2num(strTemp(42:60)); EphDat(1).M0=str2num(strTemp(61:79));