-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcompute_residuals_pseudorange.m
51 lines (42 loc) · 1.25 KB
/
compute_residuals_pseudorange.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
%% compute_residuals_pseudorange.m
% Compute pseudorange residuals
% Author: Taro Suzuki
clear; close all; clc;
addpath ../
datapath = "./data/kinematic/";
%% Read RINEX observation/navigation file
obs = gt.Gobs(datapath+"base.obs"); % static data
nav = gt.Gnav(datapath+"base.nav");
%% Compute residuals
% Compute satellite position
sat = gt.Gsat(obs, nav);
% Set receiver true position
sat.setRcvPos(obs.pos);
% Elevation mask (15 degree)
obs.mask(sat.el<15);
% Compute residuals
obs = obs.residuals(sat);
%% Plot residuals
% obs.resPc = obs.P-(sat.rng+sat.dts+sat.trp+sat.ion)
% Receiver clock error remains
figure;
plot(obs.L1.resPc);
grid on;
title("Psedudorange residuals (with receiver clock error)");
xlabel("Epochs");
ylabel("Pseudorange residuals (m)");
legend(obs.satstr,"Location","eastoutside");
%% Compute receiver clock error
% Average the residuals for each satellite system
% Because of the existence of inter-satellite system bias
meanall = @(x) mean(x,2,'omitnan');
g = findgroups(obs.sys);
rcvclk = splitapply(meanall, obs.L1.resPc, g);
% plot pseduorange residuals
figure;
plot(obs.L1.resPc-rcvclk(:,g));
grid on;
title("Psedudorange residuals");
xlabel("Epochs");
ylabel("Pseudorange residuals (m)");
legend(obs.satstr,"Location","eastoutside");