Skip to main content
. 2017 Aug 23;17(9):1932. doi: 10.3390/s17091932
Algorithm 2. Kalman Filter
Input: mk,  % object position for time step t from sensor
Output: s^k,  % a position estimation of object
1: initialize t, s^k1, A, P, Q, R  % t represents prediction time moment, s^k1 is the known posterior
       % state estimation at time moment k − 1; A represents state transition matrix;
       % P represents the covariance matrix, Q denotes covariance of the random
       % signals, and R is the matrix of observation noise covariance.
2: if filterStop = false then  % end with convergence of click the ‘stop’ button.
3:  s^kAs^k1    % calculate predicting position estimation, according to Equation (16)
4:  P ← APAT + Q  % calculate priori covariance matrix, according to Equation (17)
5:  K ← PCT(CPCT + R)  % calculate Kalman Gain matrix, according to Equation (26)
6:  s^ks^k + K(mk − Cs^k)  % calculate optimal estimation value, according to Equation (23)
7:  P ← (I − KC)P  % calculate x^k covariance, according to Equation (27), I denotes unit matrix
8:  tt + 1
9: end if