1 addpath(
'../continuous_discrete');
3 P_cell = {[5,0.5;0.5,3], [1 2 6;2 9 0.5; 6,0.5,0.1]};
6 state_count = size(P,1);
9 X_0 = randn(state_count,1); 10 Q_root = 1*eye(state_count); 12 assert(max(max(abs(P_0_sqrt*P_0_sqrt'-P)))<0.000000001);
14 A = randn(state_count,state_count);
15 f_func = @(x,t) A*x + 0*t;
16 jacobian_func = @(x,t) A + 0.*x + 0*t;
22 [estimate, covariance_sqrt] =
cdekf_predict_phase(f_func,jacobian_func,h,del_t,start_time,P_0_sqrt,X_0,Q_root);
27 phi = eye(state_count);
28 phi_sum = zeros(state_count);
29 while(cur_time < del_t)
30 phi_next = phi + (h).*(jacobian_func(x,cur_time)*phi);
31 phi_sum = phi_sum + (h/2).*( phi*Q*phi
' + phi_next*Q*phi_next');
33 x = x + h*f_func(x,cur_time);
34 p = p + h.*( jacobian_func(x,cur_time)*p + p*jacobian_func(x,cur_time)
' + Q_root*Q_root); 35 cur_time = cur_time + h; 39 phi_sum = phi_sum + phi*P*phi';
41 assert(max(max(abs(covariance_sqrt*(covariance_sqrt
')-p)))<0.000000001); function cdekf_predict_phase(in f_func, in jacobian_func, in h, in dt_between_measurements, in start_time, in P_0_sqrt, in x_0, in Q_root)