Pattern Recognition Applet: Unscented Kalman Filter

The Kalman filters are used to model signals using sequential prediction techniques. A Kalman filter is represented by two state space equations:

state equation: x(k) = Ax(k-1) + u(k-1)

observation equation: y(k) = Hx(k) + v(k)

using basic matrix computation.

It uses a recursive procedure to predict the next state of a sample signal given the previous states. After a few parameters - initial state vector, estimate error covariance, process noise covariance, observation noise covariance, transition matrix, and observation matrix - are either initialized or computed, the algorithm can be described in two main steps that repeat for all samples of the signal:
  • The state prediction stage takes the previous state and adds a gaussian process noise. Then the next stage is predicted with the state equation and a state gain factor.

  • The update state stage compares the previous state with the simulated noise to the obvservation with an observation noise to make the final prediction for the next state. The final predicted state then becomes the previous state for the next iteration.

The algorithm repeats these two steps for every observation (some literatures also refer it as measurement). The initial state is an automatically Gaussian distribution with the mean at the first observation.

Specifically, for unscented Kalman filter implementation, few more default parameters (alpha, beta, and kappa) needs to initialized. Difference between conventional Kalman filter and the unscented Kalman filter is that, the given starting values are converted into sigma points and these sigma points individually are passed through the steps described above. Each sigma point has an weight associated which is used to get back the effective mean value of the filtered signal at the end of update stage.

Here is an example run through of the kalman filtering algorithm.
  • First, the user must enter an input signal in the Input Display box. There is a random signal that can be used by selecting Random Signal from the Patterns menu. The user also can input data points on the input panel by clicking or dragging the mouse. The points must be clicked from left to right because the x-axis represents the time axis (time progression). Then, select Unscented Kalman Filtering from the Algorithms menu.

    Unscented Kalman Filtering

    All signals are sampled at regular intervals. Since it may be hard for the user to click points in regular intervals, the data is interpolated. Basically, this means that points are inserted where necessary to make there be a data sample a some regular time slot.

  • Next, the points need to be initalized. Under the Go menu click Initialize. If the points are not all from left to right along the time axis, an error message will appear. The points should then be cleared, re-entered, and re-initialized.

    To go through each step Next for each step. Step 1, after initialization, displays the input points in the Output Display box.

    The second step gives some basic information. The state and observation equations are given. Notice that the calculation of the next state is dependent on the previous state plus some noise term, and the next observation is dependent upon the previous state with some noise as well. Variables 'A' and 'H' represent the transition and observation model that in this case are both equal to one. Also, the noise variances are displayed along with the number of particles to be used.

    Unscented Kalman Filtering

  • If the user opts to use the red data points, Input Class 0, the first two iterations will be given step by step. All the particles are shown for first time slot or sample. From the calculation of the weights of the particles, the prediction is made for that time.

    Unscented Kalman Filtering

  • After the first two iterations, the remaining samples will be run at once. The predicted signal is left at each sample time and is continuously drawn by a line.

    Unscented Kalman Filtering

    Once the algorithm finishes, the mean square error is calculated and shown. This completes the process.

    Unscented Kalman Filtering

    Click here to go back to the main tutorial page.

Inquire about this domain