资源描述:
《利用MATLAB编制的GPS单点定位程序.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、functiont=TimetoJD(Y,M,D,h,f,s)if(Y>=80)Y=Y+1900;elseY=Y+2000;endifM<=2Y=Y-1;M=M+12;endJD=fix(365.25*Y)+fix(30.6001*(M+1))+D+h/24+f/1440+s/24/3600+.5;t=JD-.5;function[head,obs]=ReadObsData%读接收机观测数据文件%HeadODat:astructurestoresheaderinformationifo-file%.ApproXYZ[3];//approximatecoordinate%.interval;
2、//intervalsoftwoadjacentepochs%.SiteName;//pointname%.Ant_H;//antennaheight%.Ant_E;//eastoffsetoftheantennacenter%.Ant_N;//northoffsetofthenantennacenter%.TimeOB;//firstepochtimeinmodifuiedJuliantime%.TimeOE;//lastepochtimeinmodifuiedJuliantime%.SumOType;//numberoftypesofobservables%.SumOO[SumOTyp
3、e];//typeofobservables0-L1,1-L2,2-C1,3-P1,4-P2,5-D1,6-D2,%ObsODat:astructurestoresobservablesbyoneandoneepoch%.TimeOEpp[2];//recievertimeofepoch%.SatSum;//numberofsatellites%.SatCode[SatSum];//satellites'PRN%.Obs_FreL1[SatSum];%.Obs_FreL2[SatSum];%.Obs_RangeC1[SatSum];%.Obs_RangeP1[SatSum];%.Obs_R
4、angeP2[SatSum];globalHeadODat;globalObsODat;[fname,fpath]=uigetfile('*.*','选择一个O文件');O_filename=strcat(fpath,fname);fid1=fopen(O_filename,'rt');if(fid1==-1)msgbox('fileinvalide','warning','warn');return;end%将文件头数据存入结构体HeadODat中t=0;while(t<100)s=fgets(fid1);t=t+1;L=size(s,2);ifL<81s(L+1:81)='';endi
5、nstrS=s(61:81);%测站点近似坐标ifstrncmp(instrS,'APPROXPOSITIONXYZ',19)HeadODat.ApproXYZ=zeros(1,3);HeadODat.ApproXYZ(1,1)=str2num(s(1:14));HeadODat.ApproXYZ(1,2)=str2num(s(15:28));HeadODat.ApproXYZ(1,3)=str2num(s(29:42));%历元间隔;elseifstrncmp(instrS,'INTERVAL',8)HeadODat.interval=str2num(s(5:11));%测站点号else
6、ifstrncmp(instrS,'MARKERNAME',11)HeadODat.SiteName=s(1:4)%天线中心改正elseifstrncmp(instrS,'ANTENNA:DELTAH/E/N',20)HeadODat.Ant_H=str2num(s(1:14));HeadODat.Ant_E=str2num(s(15:28));HeadODat.Ant_N=str2num(s(29:42));%第一个历元时间elseifstrncmp(instrS,'TIMEOFFIRSTOBS',17)year=str2num(s(1:6));month=str2num(s(7:12)
7、);day=str2num(s(13:18));hour=str2num(s(19:24));minute=str2num(s(25:30));second=str2num(s(31:42));HeadODat.TimeOB=TimetoJD(year,month,day,hour,minute,second);%最后一个历元时间elseifstrncmp(instrS,'TIMEOFLASTOBS',16)year=s