% Written by: % -- % John L. Weatherwax 2005-08-14 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clc; %format rat; Phi = 1; H = 1; % measurement mapping matrix Q = 30; % process noise covariance R = 20; % measurement noise covariance P_p = 150; % initial value of state error covariance P_0 = P(+) % iterate the covariance equations: for k=1:4, P_m = Phi * P_p * Phi + Q; K_bar = P_m * H / ( H * P_m * H + R ); P_p = ( 1 - K_bar ) * P_m; fprintf( 'k = %10d: P_m=%10.6f K_bar=%10.6f P_p=%10.6f \n', k, P_m, K_bar, P_p ); end