Four telling examples of Kalman Filters Example : Signal plus noise Measurement of a bandpass signal, center frequency.2 rad/sec buried in highpass noise. Dig out the quadrature part of the signal while rejecting the noise as well as possible. x q k+ x i k+ = x d k+.882.876.876.882.8 y k = ( ) x k + v k. x q k x i k x d k + w q k wk i, wk d Q = diag ( 5 ), R =.,.8337.246.7548 Σ =.246.2336.225.7548.225 5.753, M = ˆx k+ k = (A + MC)ˆx k k + My k..2388.949.5732
6 5 Bode magnitude plots of noise to state transfer functions In phase Quadrature Noise 4 Magnitude 3 2.5.5 2 2.5 3 3.5 Discrete frequency (rad/sec) 2
8 7 Magnitude plots of signal, noise and KF spectra State spectrum Kalman filter magnitude Noise spectrum 6 5 Magnitude 4 3 2.5.5 2 2.5 3 3.5 Discrete frequency (rad/sec) Q = diag ( 5 ). 3
6 5 Magnitude plots of signal, noise and KF spectra State spectrum Noise spectrum Kalman filter magnitude Noise spectrum 4 Magnitude 3 2.5.5 2 2.5 3 3.5 Discrete frequency (rad/sec) Q = diag ( ). 4
Kalman Filter Operation Produces a standard filter in the Digital Signal Processing sense. Picking out state elements is possible to access estimates of specific components. Specification of the following is key to the operation of the Kalman Filter. A signal state model things we want, A noise state model things we want to reject, Relative power of signals, Q is like the signal power, R is like the noise power. 5
Telling example 2 estimation of the mean Consider the following signal y k = γ + v k, where v k is a white noise, zero mean, variance. and we want to estimate γ the mean of y k using these measurements. Obvious answer: ˆγ k = k+ ki= y k. The optimal mean estimator the sample mean. Kalman filter version: Set up state model so that x k = γ, x k+ = x k + w k y k = x k + v k. A =, C =, Q =, R =. 6
A =, C =, Q =, R =. Σ k+ k = A k Σ k k A T k A kσ k k C T k (C kσ k k C T k +R k) C k Σ k k A T k +Q k. Σ k+ k = Σ k k Σ 2 k k (Σ k k + ) = Σ k k Σ k k +. Σ k k = k + Σ, K k = ˆγ k+ k = + k + Σ ˆγ k k + = k + Σ + k + Σ ˆγ k k + = Σ + k + Σ ˆγ + + k + Σ. + k + Σ + k + Σ + k + Σ y k, k i= y i. y k, 7
Sample Mean Estimator Points to note: Kalman knows better than you about the optimal estimator it is the same as the sample mean if Σ =. The propagation of the covariance is critical to the understanding of the optimal estimator. The time-varying filter is optimal BUT the stationary filter has K k =. The stationary filter is not even asymptotically stable. AHA!: The filtering problem has [A, Q o ] with uncontrollable modes on the unit circle no stabilizing solution exists. The Kalman Filter is nothing to be afraid of. Although it can misbehave if we do not know what we are doing. 8
Telling Example 3 Least Squares Regression Example: AutoRegressive exogenous input modeling y k = a y k a 2 y k 2... a n y k n + b u k +... + b n u k n + e k, or A(z)y k = z B(z)u k + e k. ARX model. We measure {y k, u k } and we want to estimate the parameter vector θ T = ( a a 2... a n b... b n ). State-space model for the parameters and measurements θ k+ = θ k y k = φ k θ k + e k, where e k is white noise and the regressor is φ T k = ( y k y k... y k n u k... u k n ). This is in the time-varying Kalman Filtering formulation. 9
Kalman filter to estimate state θ k. θ k+ = θ k y k = φ T k θ k + e k, ˆθ k+ k = ˆθ k k + K k [y k φ T k ˆθ k k ], K k = P k φ k (φ T k P kφ k + R), P k = P k P k φ k (φ T k P kφ k + R) φ T k P k. Rewriting the recursions a little (matrix inversion lemma) Pk+ = P k = P + + φ k R φ T k k i= K k = P k+ φ k R. This recursion minimizes the criterion min θ lim N φ i R φ T i, N N E [y i φ T i θ]2 i=
Telling example 3 Recursive Least Squares The previous KF is the Recursive Least Squares parameter estimation algorithm of systems identification for fitting ARX models. The covariance P k satisfies P k = P + k i= φ i R φ T i It suffers from the same problems as the mean estimator. If the regressor sequence φ i is stationary with full-rank covariance then P k and K k. This, of course, is the correct answer for minimizing the one-step-ahead prediction error. The property that φ i have full-rank covariance is known as persistence of excitation. Without it, there is not enough information in y k to let us converge to the correct θ..
Telling example 4 Differentiation of a Signal In longwall coal-mining, roof collapse or gas-out of the floor is a safety and productivity problem people and machines can be buried behind the collapse. Suppose we are given a signal s t of the roof strain, as measured by instrumented breaker line supports, and we wish to generate an estimate of the strain rate which is not too noisy. 2 57
Telling example 4 Differentiation of a Signal Set up a fictitious state-space model containing what we want. x k+ = x k + w k, x 2 k+ = x2 k + x k, s k = x 2 k + v k. Here we have posited a model which writes the measured signal, s k, (which is the only one that really exists) as the noisy measurement of x 2 k, which in turn is the integral of x k. AHA! Estimating x k is the same as differentiating s k. A = ( ), C = ( ), Q = ( ) q, R = r. 3
.9.8 Frequency response magnitude plots of KF differentiator Q=, R=.5 Q=, R= Q=, R=.7.6 Magnitude.5.4.3.2..5.5 2 2.5 3 3.5 Discrete Frequency (rad/sec) Differentiator performance tuned using Q/R knob. 4