diff --git a/src/utils/matlab/vtl/kf_prototype.m b/src/utils/matlab/vtl/kf_prototype.m new file mode 100644 index 000000000..a113e4357 --- /dev/null +++ b/src/utils/matlab/vtl/kf_prototype.m @@ -0,0 +1,142 @@ +%% vtl KF +%% +sat_number=5; +%% ################## Kalman filter initialization ###################################### +% covariances (static) +kf_P_x = eye(8)*10.0; %TODO: use a real value. +kf_x = zeros(8, 1); +kf_R = zeros(2*sat_number, 2*sat_number); +kf_dt=0.1; +kf_F = eye(8, 8); +kf_F(1, 4) = kf_dt; +kf_F(2, 5) = kf_dt; +kf_F(3, 6) = kf_dt; +kf_F(7, 8) = kf_dt; + +kf_H = zeros(2*sat_number,8); +kf_y = zeros(2*sat_number, 1); +kf_yerr = zeros(2*sat_number, 1); +% kf_xerr = zeros(8, 1); +kf_S = zeros(2*sat_number, 2*sat_number); % kf_P_y innovation covariance matrix + +%% State error Covariance Matrix Q (PVT) +kf_Q = eye(8);%new_data.rx_pvt_var(i); %careful, values for V and T could not be adecuate. +%% + +% Measurement error Covariance Matrix R assembling +for chan=1:5 %neccesary quantities + for t=1:length(navSolution.RX_time) + % It is diagonal 2*NSatellite x 2*NSatellite (NSat psudorange error;NSat pseudo range rate error) + kf_R(chan, chan) = 40.0; %TODO: fill with real values. + kf_R(chan+sat_number, chan+sat_number) = 10.0; + end +end + +%% ################## Kalman Tracking ###################################### +% receiver solution from rtklib_solver +for t=1:length(navSolution.RX_time) + + if (t