# EE3901/EE5901 Sensor TechnologiesWeek 4 Tutorial

**Dr. Bronson Philippa**

## Question 1

Given a state prediction model of the form

the extended Kalman filter predicts the covariance using the equation:

where $F$ is the Jacobian of $f\left(\cdot\right)$ and $Q_{k}$ is the process covariance.

**Calculate the Jacobian for each prediction model given below.**

(a)

(b)

(c)

(d)

## 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

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 $\theta$ is the direction of heading measured clockwise from north.

(a) Write a prediction function $\hat{\boldsymbol{x}}_{k|k-1}=f(\hat{\boldsymbol{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 $\boldsymbol{z}$ and hence write down the measurement model $h$ in the expression $\boldsymbol{z}_{predicted}=h\left(\hat{\boldsymbol{x}}_{k|k-1}\right).$

(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.

## 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:

The measurements are the voltages,

The LED is described by the Shockley diode equation,

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 $\text{C}_{2}$. Recall that capacitors are described by $i=C\frac{dv}{dt}$.

(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

fails to converge to the correct solution (unless $\Delta 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 $\Delta 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.