3 addpath(
'../continuous_discrete');
4 addpath(
'../discrete_discrete');
6 P_cell = {[5,0.5;0.5,3], [1 2 6;2 9 0.5; 6,0.5,0.1]};
9 state_count = size(P,1);
12 assert(max(max(abs(P_root*P_root'-P)))<0.0000000001);
15 estimate = randn(state_count,1);
16 C = randn(1,state_count);
18 [estimate_next, covariance_sqrt] =
ddekf_update_phase(R_root,P_root,C,estimate,measurement);
19 [estimate_next2, covariance_sqrt2] =
cdekf_update_phase(R_root,P_root,C,estimate,measurement);
21 %manual test (the classic udpate filter algorithm without square root algorithm)
22 K_k = (P_root*P_root
')*(C')*inv(C*(P_root*P_root
')*C'+R_root*R_root);
23 coV = (eye(state_count) - K_k*C)*(P_root*P_root
'); 24 estimate_new = estimate + K_k*(measurement - C*estimate); 26 assert(norm(estimate_new - estimate_next) < 0.000000000001); 27 assert(max(max(abs(covariance_sqrt*covariance_sqrt' - coV))) < 0.0000000001)
30 disp(
'update phase tested succesfully')
function ddekf_update_phase(in R_root, in P_root, in C, in estimate, in measurement)
function cdekf_update_phase(in R_root, in P_root, in C, in estimate, in measurement)