College of Science and Engineering, James Cook University
Last updated: 21 March 2023
Question 1
Given a state prediction model of the form
x^k∣k−1=f(x^k−1),
the extended Kalman filter predicts the covariance using the equation:
Pk∣k−1=FPk−1FT+Qk,
where F is the Jacobian of f(⋅) and Qk
is the process covariance.
Calculate the Jacobian for each prediction model given below.
(a)
f(x)=x−x2Δt
(b)
f(x)=f(xy)=(x+y2(1−Δt)y)
(c)
f(x)=f⎝⎛xyz⎠⎞=⎝⎛x−yzy−xzz−xy⎠⎞
(d)
f(x)=f⎝⎛xyt⎠⎞=⎝⎛x+costy+sintt+Δt⎠⎞
(a) In this case the Jacobian is a scalar.
J=1−2xΔt.
(b)
J=[102y(1−Δt)].
(c)
J=⎣⎡1−z−y−z1−x−y−x1⎦⎤.
(d)
J=⎣⎡100010−sintcost1⎦⎤.
Question 2
Develop the equations for an extended Kalman filter for a vehicle moving in a 2D plane as shown in Figure Q2.
The vehicle is described by the state vector
x=⎝⎛xysθ⎠⎞,
where x is the position along the east-west axis, y is the position
along the north-south axis, s is the speed of movement (where positive
s means forward motion), and θ is the direction of heading
measured clockwise from north.
(a) Write a prediction function x^k∣k−1=f(x^k−1).
(b) Calculate the Jacobian of f and hence write the equation for the predicted covariance.
(c) Suppose that the sensors on the vehicle are GPS (measuring position), a speedometer, and a compass. Define which variables would go into the measurement vector z and hence write down the measurement model h in the expression zpredicted=h(x^k∣k−1).
(d) Suppose that the vehicle has no GPS and the only sensors are a speedometer and compass. Repeat part (c) with a reduced set of sensors.
(a) Prediction step (based upon an assumption of constant speed)
(c) The measurements can be arranged in a measurement vector
z=⎝⎛x position from GPSy position from GPSspeedheading⎠⎞.
This is the same ordering as the state vector so the measurement model
is linear and is given by
zpred=Hxk∣k−1,
where the measurement matrix H is
H=⎣⎡1000010000100001⎦⎤.
If your measurement vector had the measurements in a different order
then the corresponding rows of H would be swapped.
(d) In this case there are only two measurements
z=(speedheading)
and the measurement matrix becomes
H=[00001001].
Question 3
Develop an unscented Kalman filter for the non-linear circuit shown in Figure Q3.1.
This is a second-order system, so it requires two state variables. Choose the following state vector:
x^=(V^1V^2).
The measurements are the voltages,
z=(V1V2).
The LED is described by the Shockley diode equation,
iD=10−12(eV2/0.026−1),
where the device parameters (e.g. reverse bias saturation current,
ideality factor, and temperature) have already been substituted into
the equation. Notice that the voltage across the diode is the same
as the voltage across C2. Recall that capacitors are
described by i=Cdtdv.
(a) Analyse the circuit and show that it is described by the following
set of differential equations:
(b) At the point where the diode begins to turns on, these equations are
highly non-linear and are numerically challenging to solve. A simple
prediction model of the form
(V2)k∣k−1=(V2)k−1+(dtdV2)Δt
fails to converge to the correct solution (unless Δt is made
impractically small). Figure Q3.2 shows instability resulting
from the inadequacies of such a simple prediction model.
The instability (indicated with an arrow) would cause problems for
any kind of Kalman filter since the prediction model is failing. An
improved prediction model requires the use of a differential equation
solver that can dynamically choose Δt to maintain accuracy.
Hence, the prediction step is a computer program, and a derivative-free
method like the UKF is required.
Write code to implement an unscented Kalman filter for this system. Starter code is provided that implements an accurate prediction step. Based upon this predictive model, you can build a reliable filter. Write your code and evaluate its performance.
Using the parameters in the starter code, the working UKF produces output like Figure Q3.3.