B_POINT.M
资源名称:easy.zip [点击查看]
上传用户:sfyaiting
上传日期:2009-10-25
资源大小:320k
文件大小:2k
源码类别:
GPS编程
开发平台:
Matlab
- function pos = b_point(pr,sv,time,Eph)
- %B_POINT Prepares input to the Bancroft algorithm for finding
- % a preliminary position of a receiver. The input is
- % four or more pseudoranges and the coordinates of the
- % satellites.
- %Kai Borre and C.C. Goad 11-24-96
- %Copyright (c) by Kai Borre
- %$Revision: 1.1 $ $Date: 1997/11/10 $
- v_light = 299792458;
- dtr = pi/180;
- m = size(pr,1);
- for t = 1:m
- col_Eph(t) = find_eph(Eph,sv(t),time);
- end
- pos = zeros(4,1); % First guess Earth center
- for l = 1:2
- B = [];
- for jsat = 1:m
- k = col_Eph(jsat);
- tx_RAW = time - pr(jsat)/v_light;
- t0c = Eph(21,k);
- dt = check_t(tx_RAW-t0c);
- tcorr = (Eph(2,k)*dt + Eph(20,k))*dt + Eph(19,k);
- tx_GPS = tx_RAW-tcorr;
- dt = check_t(tx_GPS-t0c);
- tcorr = (Eph(2,k)*dt + Eph(20,k))*dt + Eph(19,k);
- tx_GPS = tx_RAW-tcorr;
- X = satpos(tx_GPS, Eph(:,k));
- if l ~= 1
- rhosq = (X(1)-pos(1))^2+(X(2)-pos(2))^2+(X(3)-pos(3))^2;
- traveltime = sqrt(rhosq)/v_light;
- Rot_X = e_r_corr(traveltime,X);
- rhosq = (Rot_X(1)-pos(1))^2 + ...
- (Rot_X(2)-pos(2))^2 + ...
- (Rot_X(3)-pos(3))^2;
- traveltime = sqrt(rhosq)/v_light;
- [az,el,dist] = topocent(pos(1:3,:),Rot_X-pos(1:3,:));
- % [phi,lambda,h] = togeod(6378137, 298.257223563, ...
- % pos(1), pos(2), pos(3));
- trop = tropo(sin(el*dtr),0.0,1013.0,293.0,50.0,...
- 0.0,0.0,0.0);
- else trop = 0;
- end
- corrected_pseudorange = pr(jsat)+v_light*tcorr-trop;
- B(jsat,1) = X(1);
- B(jsat,2) = X(2);
- B(jsat,3) = X(3);
- B(jsat,4) = corrected_pseudorange;
- end; % jsat-loop
- pos = bancroft(B);
- [phi,lambda,h] = togeod(6378137, 298.257223563, ...
- pos(1), pos(2), pos(3));
- end; % l-loop
- clock_offset = pos(4)/v_light;
- pos(4) = clock_offset*1.e+9; % ns
- %%%%%%%%%%% b_point.m %%%%%%%%%%%%%%%%%%%%%%%%%