EASY3.M
资源名称:easy.zip [点击查看]
上传用户:sfyaiting
上传日期:2009-10-25
资源大小:320k
文件大小:2k
源码类别:
GPS编程
开发平台:
Matlab
- % EASY3 Read RINEX navigation file reformat into Matlab Eph matrix.
- % Open a RINEX observation file analyse the header and identify
- % observation types. The function fepoch_0 finds epoch time
- % and observed PRNs in an OK epoch (digit 0, RTK observations
- % will have a 2 in this place). Next we read the observations
- % and use recpo_ls to get a least-squares estimate for the
- % (stand alone) receiver position.
- %Kai Borre 27-07-2002
- %Copyright (c) by Kai Borre
- %$Revision: 1.0 $ $Date: 2002/07/27 $
- % Read RINEX ephemerides file and convert to
- % internal Matlab format
- rinexe('SITE247J.01N','eph.dat');
- Eph = get_eph('eph.dat');
- % We identify the observation file and open it
- ofile1 = 'SITE247J.01O';
- fid1 = fopen(ofile1,'rt');
- [Obs_types1, ant_delta1, ifound_types1, eof11] = anheader(ofile1);
- NoObs_types1 = size(Obs_types1,2)/2;
- Pos = [];
- % There are 20 epochs of data in ofile1
- for q = 1:20
- [time1, dt1, sats1, eof1] = fepoch_0(fid1);
- NoSv1 = size(sats1,1);
- % We pick the observed P2 pseudoranges
- obs1 = grabdata(fid1, NoSv1, NoObs_types1);
- i = fobs_typ(Obs_types1,'P2');
- pos = recpo_ls(obs1(:,i),sats1,time1,Eph);
- Pos = [Pos pos];
- end
- me = mean(Pos,2);
- fprintf('nMean position as computed from 20 epochs:')
- fprintf('nnX: %12.3f Y: %12.3f Z: %12.3f', me(1,1), me(2,1), me(3,1))
- plot_handles = plot(1:q,(Pos(1,:)-Pos(1,1)*ones(1,q))','-',...
- 1:q,(Pos(2,:)-Pos(2,1)*ones(1,q))','--',...
- 1:q,(Pos(3,:)-Pos(3,1)*ones(1,q))','-.')
- set(gca,'fontsize',16)
- set(plot_handles,'linewidth',2)
- title('Pseudorange Positions Over Time')
- xlabel('Epochs [1 s interval]')
- ylabel('Variation in Coordinates, Relative to the First Epoch [m]')
- legend('X','Y','Z')
- print -deps easy3
- %%%%%%%%%%%%%%%%%%%%% end easy3.m %%%%%%%%%%%%%%%