Lecture 1

advertisement
Lecture 1
Motivation for the Kalman Filtering Algorithm
This lecture concerns many of the major topics that will be covered in this course. They are presented now to give the reader an
understanding and appreciation of the need for the material they rely on. This material relates to three major subjects; subjects that are
courses, in and of themselves! They include (i) random variables and random processes, linear systems and control, and signal
processing.
Few, if any students taking this course have had any prior courses in more than one of these three areas. Hence, it is essential that this
material be viewed as motivational. The student is not expected to grasp it at this point. The student is expected to pursue some
independent reading of the related material in the textbook used for this course. A comprehensive treatment of that material is not
possible if we are to cover the various elements of Kalman filtering in a single course.
Having said this, the student should realize that upon leaving this course, he/she will not be an ‘expert’ in Kalman filtering. This course
will, instead, prepare the student to converse about the subject, see its value in a variety of applied areas, and provide the motivation
and background to pursue the above subjects in self-study, as well as more advanced courses.
The various topics that form the basis of this course will be covered in this lecture. Subsequent to the lecture, the student should revisit
this material, and highlight elements of the lecture that he/she is unfamiliar with. By doing so, a roadmap to the remainder of the
semester will become apparent.
AN OVERVIEW OF KALMAN FILTERING
Let
zk  [ zk1,, zk m ]tr and let xk  [ xk1 ,, xk n ]tr . Assume the relationship between these random processes is:
xk 1  Fk xk  Gk wk
(1a)
zk  H k xk  Dk vk
(1b)
where (1a) includes the known and non-random ( n  n matrix-valued) parameters Fk and Gk, as well as the n-D non-measurable white
noise random process wk with
E(wk wktr j )  I   ( j ) and E(vk vktr j )  I   ( j ) .
(2)
Then, from Figure 5.8 on p.219, we have the following KF algorithm:




Step 1: For k=0 choose a value for x0 and compute the prediction error variance P0  E[( x0  x0 )( x0  x0 ) ] . Notice that, if you


choose x0 =0, then you have P0  E[ x0 x0 ] .
Step 2: For k=0:
tr
Compute the Kalman gain:
K k  Pk H ktr ( H k Pk H ktr  Dk Dktr ) 1 .
Step 3: Compute the update estimate:



xk  xk  K k ( zk  H k xk ) .
Step 3: Compute the update error variance:
Pk  ( I  K k H k ) Pk .
Step 4: Compute 1-step prediction and associated error variance:
Step 5: Go to Step 2 and increment k by one.


xk1  Fk xk ;
Pk1  Fk Pk Fktr  Gk Gktr
tr
Example 1. Consider the state “signal” process AR(1) 1-dimensional process
xk 1  a xk  wk where the process wk is a zero-mean,
E( wk2 )   w2
Gaussian white noise process with variance
.
Q0: What is the numerical value of Gk in (1a) above?
A0: _________________________________________________________________________________________________ .
Q1: What IS a random process?
A1: _________________________________________________________________________________________________ .
Q2: What IS a signal?
A2: _________________________________________________________________________________________________ .
Q3: What IS a white noise process?
A3: _________________________________________________________________________________________________ .
Q4: What role does the parameter a play?
A4: _________________________________________________________________________________________________ .
Q5: Typically, it is presumed that the process xk is a wide sense stationary (wss) random process. What IS a wss Process?
A5: _________________________________________________________________________________________________ .
Q6: Were we to use Matlab to simulate a partial realization of xk, what IS a partial realization of a random process?
A6: _________________________________________________________________________________________________ .
Q7: How would we use Matlab to simulate a partial realization of xk?
A7: _________________________________________________________________________________________________ .
Q8: What might a partial realization of xk look like for various chosen values of the parameter a?
A8: _________________________________________________________________________________________________ .
xk 1  a xk  wk was obtained by sampling the continuous-time process x(t ) that
is described by the stochastic differential equation x (t )   x(t )   (t ) , where  (t ) is a continuous-time zero-mean Gaussian
white noise process. If we view this differential equation as a linear time-invariant (LTI) system, with ‘input’  (t ) and ‘output’
x(t ) , what is the system transfer function, H(s)?
Q9: Suppose that the discrete-time process
A9: _________________________________________________________________________________________________ .
Q10: What is the system corresponding impulse response, h(t)?
A10: _____________________________________________________________________________________ ____________ .
Q11: What is the system frequency response function (FRF), H(ω)?
A11: _________________________________________________________________________________________________ .
Q12: How would you use Matlab to investigate what the system FRF look like for various chosen values of the parameter α?
A12: _________________________________________________________________________________________________ .

Q13: The autocorrelation function of a wss random process, say y(t), is defined as
Ryy ( )  E[ y(t ) y(t   )] . The power
spectral density (psd) of the same process, S yy ( ) is defined as the Fourier transform of R yy ( ) . The psd for the continuoustime zero-mean white noise process
 (t ) is S ( )   2 . What is the corresponding R ( ) ?
A13: _________________________________________________________________________________________________ .
nk   n vk , where the process vk is a zero-mean, unit variance Gaussian white noise process. Then the
signal-plus-noise measurement process is zk  xk  nk . Write a KF code to recover an estimate of the signal. Then test this code by
Consider a “noise” process
running it a 1000-point time record of the measurement process. To specify the numerical values of the parameters σ1, σn and α, first
note that the variance,
 x2 of th signal can be expressed as  x2   12 /(1   2 ) . The variance of the noise is  22 . Hence, the signal-to-
noise ratio is:
 x2
 w2
SNR  2  2
.
 n  n (1  a 2 )

Case 1: SNR=1 and α=0.9.
Case 1: SNR=1 and α=0.3.
APPLICATION TO A TIME-VARYING AR(1) PROCESS
In this work we will mainly focus on the problem of detecting changes related to a time-varying first order autoregressive, AR(1),
measurement process:
zk  ak zk 1  vk
; E (vk2 )   v2 (k )
In the special case where the AR(1) parameter ak and the white noise variance
(3a)
 v2 ( k ) do not depend on the time index, k, the process
(3) is a wss random process as long as the condition | a | 1 holds. Why is this required?
In the case where the AR(1) parameter ak changes slowly in relation to the sampling interval. In this sense, the process (3) is a locally
wss process, and it is easy to show that the process variance (or power) is given by
 z2 (k )   v2 (k ) /(1  ak2 ) .
(3b)
The model (3b) has the ability to capture the slow time variation in both the process power, and time-varying frequency
content can be captured by the AR(1) parameter, ak.
Example. In relation to the process (3), suppose that the AR(1) parameter is changing in the manner described in Figure 1.
Timevarying AR(1) Parameter
1
0.9
0.8
0.7
a
k
0.6
0.5
0.4
0.3
0.2
0.1
0
100
200
300
400
500
600
Time Index (k)
700
800
900
1000
Figure 1. Time-varying AR(1) parameter, ak.
Corresponding sample of unit variance t.v. AR(1) process
3
2
z
k
1
0
-1
-2
-3
0
100
200
300
400
500
600
Time Index (k)
700
800
Figure 2. Measurement of zk associated with (3) and Figure 1. How was this generated?
900
1000
In Figure 2 we see that the process power is held constant, while the dynamics go from slow to fast over time. As shown in Figure 1,
we see that the change from a wss process with a=0.9 to one with a=0.4 does not occur instantaneously. Rather, there is a transition
region (400-500) where the parameter value decreases linearly. Hence, the notion of change detection must be clarified. It is one thing
to decide whether or not a=0.9, but it is another to decide if a=0.9 or a=0.4. Which notion of change is used would depend, in part, on
whether one had knowledge of both values. We will address this distinction throughout this example.
How does the AR(1) parameter, a, relate to the system dynamics?
We now present methods of KF related to detecting such a change.
Method 1: Here we will concentrate on tracking ak. In this case we will use measurements of the process (3) to filter out estimates of
the ak’s. The state model (2a) used here is
ak  ak 1  wk ; Qk   w2
(4a)
and the measurement model is
zk  ak zk 1  vk
; E (vk2 )   v2 (k )
(4b)
(3a). Hence, the quantities in the model (2) become:
xk  ak ; Fk  Gk  1; Qk   w2 ; H k  zk 1; Rk   v2 (k ) .
There are two items here that make this KF suboptimal in the sense of minimizing the mean squared error between the state
process xk and any estimator of it:
1.The parameter
H k  zk 1 is not a non-random quantity. However, because at time k we have knowledge of zk-1, it is conditionally
non-random. In this sense, the KF is known as an extended KF.
2.We do not have knowledge of Rk   v ( k ) , which is the driving white noise for the process (3).
2
However, we do know that the process power (3b) is constant and known. Hence, with our estimate
2
2

a k we can estimate this white
noise variance as  v (k )  max{ 0 ,  z (1  ak ) } .
2
The most difficult quantity to specify is the state noise variance Qk   w .
2
If we set this value to zero, then we are forcing the AR parameter ak to remain constant and equal to the initial condition specified (in
this case, 0.9). If we make this variance to large, then the KF will track more rapid changes in the AR parameter, but with more
variability. A similar trade-off occurs in sliding window types of analyses. If the window is short, more rapid changes can be tracked,
but with higher variability. A longer window leads to slower response to changes, but with less variability.
1
0.9
0.8
Q=0.00001
0.7
Q=0.001
a
k
0.6
0.5
0.4
0.3
0.2
0.1
0
100
200
300
400
500
600
Time Index (k)
Figure 3. KF estimates of ak for Qk   w : 0.00001 and 0.001.
2
700
800
900
1000
The trade-off between bias and variability is clear. What is not clear is how this translates into change detection. If we define change as
change in relation to the value 0.9, then Figure 3 would include numerous false detections for a threshold value of, say, 0.8. If we
desire to detect whether ak is 0.9 or 0.4, with say a threshold value of 0.65, then the only incorrect detections occur in the transition
region. The following method is designed to rapidly detect whether ak has one of two specified values.
End of Lecture 1
Download