当前位置:
文档之家› GPS测量与数据处理实验报告
GPS测量与数据处理实验报告
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);
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周秒
《GPS测量与数据处理(N文件)》实验(上机)报告
班级·学号姓名实验日期6月10号任课教师
实验名称
实践型
一、实验目的及要求
1.通过编程N文件,深入理解matlab编程方式与运行原理。
2..通过老师给定的N文件,看懂并在理解的基础上,加入自己的内容。
3.学习高级语言软件MATLAB.
二、实验平台
1.微机一台
%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)
for i=1:length(EphDat)
if(EphDat(i).SatPRN==TempEph.SatPRN)
if(abs(TempEph.toc-EphDat(i).toc)<3600)
Increase=false;
break;
end
end
end
if(~Increase)
for i=1:7 %读入剩余的7行
EphDat(1).IODC=str2num(strTemp(61:79));
strTemp=fgets(fp); %the eigth line
%read the other epochs
while(1)strTem=fgets(fp);if(strTemp==-1)
break;
end
TempEph.SatPRN=str2num(strTemp(1:2));
if (Year>80) %GPS从20C80年代上商用
Year=Year+1900;
else
Year=Year+2000;
end
TempEph.toc=ConvertGpsTime(Year,Mon,Day,THour,TMin,TSec);
%判断是否有新的星历出现,如果没有则增加
Increase=true;
%.e; //卫星轨道扁心率
%.Cus; //纬度幅角正弦调和改正项振幅
%.sqrtA; //卫星轨道长半径方根
%.Toe; //星历参考时间
%.Cic; //轨道倾角余弦调和改正项振幅
%.OMG0; //升交点赤经
%.Cis; //轨道倾角正弦调和改正项振幅
%.I0; //轨道倾角
%.Crc; //轨道半径余弦调和改正项振幅(m)
TempEph.I0=str2num(strTemp(1:22));
TempEph.Crc=str2num(strTemp(23:41));
TempEph.omg=str2num(strTemp(42:60));
TempEph.OMG0dot=str2num(strTemp(61:79));
strTemp=fgets(fp); %read the sixth line
EphDat(1).OMG0=str2num(strTemp(42:60));
EphDat(1).Cis=str2num(strTemp(61:79));
strTemp=fgets(fp); %read the fifth line
EphDat(1).I0=str2num(strTemp(1:22));
strTemp=fgets(fp); %read the third line
EphDat(1).Cuc=str2num(strTemp(1:22));
EphDat(1).e=str2num(strTemp(23:41));
EphDat(1).Cus=str2num(strTemp(42:60));
% .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; //时钟数据有效期
%Begin program
[filename,pathname]=uigetfile('*.**N','读取GPS广播星历文件');
fp=fopen(strcat(pathname,filename),'rt');
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));
TempEph.I0dot=str2num(strTemp(1:22));
TempEph.ISL2=str2num(strTemp(23:41));
TempEph.GpsWn=str2num(strTemp(42:60));
TempEph.ISL2P=str2num(strTemp(61:79));
TempEph.Toe=str2num(strTemp(1:22));
TempEph.Cic=str2num(strTemp(23:41));
TempEph.OMG0=str2num(strTemp(42:60));
TempEph.Cis=str2num(strTemp(61:79));
strTemp=fgets(fp); %read the fifth line
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
2.matlab软件一套
三、实验内容
请写出实验内容的操作步骤(本表不够填写可加页):
(请写出实验内容各环节的详细操作步骤(可附屏幕截图)和常用功能的实现代码清单)
三、实验内容1.打开MATLAB程序及面如下图所示
2.打开已有的REND N RINEX文件,并点击运行,运行成果如下(具体程序段见附录)。
TempEph.Cuc=str2num(strTemp(1:22));
TempEph.e=str2num(strTemp(23:41));
TempEph.Cus=str2num(strTemp(42:60));
TempEph.sqrtA=str2num(strTemp(61:79));
strTemp=fgets(fp); %read the fourth line
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));
EphDat(1).sqrtA=str2num(strTemp(61:79));
strTemp=fgets(fp); %read the fourth line
EphDat(1).Toe=str2num(strTemp(1:22));
EphDat(1).Cic=str2num(strTemp(23:41));
strTemp=fgets(fp); %the seventh line
EphDat(1).SatAccu=str2num(strTemp(1:22));
EphDat(1).SatHth=str2num(strTemp(23:41));
EphDat(1).Tgd=str2num(strTemp(42:60));
TempEph.IODE=str2num(strTemp(1:22));
TempEph.Crs=str2num(strTemp(23:41));
TempEph.DetaN=str2num(strTemp(42:60));
TempEph.M0=str2num(strTemp(61:79));