# EKF/UKF Toolbox for Matlab V1.3

Maintainers: Simo Särkkä, Jouni Hartikainen, Arno Solin

### News

- 2011-08-16 Published new version of the document.
- 2011-08-11 Published new version (1.3) with Gauss-Hermite and third order cubature rule based filters and smoothers. The documentation is also updated, and few bug fixes included in the code.
- 2007-09-04 Published new version (1.2) with few bug fixes and IMM filters and smoothers.
- 2007-09-04 Published new version (1.1) with fixes in m-file documentation
- 2007-08-07 First version of toolbox and documentation have been published!

### Introduction

EKF/UKF is an optimal filtering toolbox for Matlab. Optimal filtering is a frequently used term for a process, in which the state of a dynamic system is estimated through noisy and indirect measurements. This toolbox mainly consists of Kalman filters and smoothers, which are the most common methods used in stochastic state-space estimation. The purpose of the toolbox is not to provide highly optimized software package, but instead to provide a simple framework for building proof-of-concept implementations of optimal filters and smoothers to be used in practical applications.

Most of the code has been written by Simo Särkkä in the Laboratory of Computational Engineering. Later Jouni Hartikainen and Arno Solin documented and extended it with new filters and smoothers as well as simulated examples.

### License

This software is distributed under the GNU General Public License (version 2 or later); please refer to the file License.txt, included with the software, for details.

Download and Installation guide

### Documentation

The documentation demonstrates the use of software as well as state-space estimation with Kalman filters in general. The purpose is not to give a complete guide to the subject, but to discuss the implementation and properties of Kalman filters.

The methods that are discussed in the current documentation are:

- Kalman filters and smoothers.
- Extended Kalman filters and smoothers
- Unscented Kalman filters and smoothers
- Gauss-Hermite Kalman filters and smoothers
- Cubature Kalman filters and smoothers
- Interacting Multiple Model (IMM) filters and smoothers

Useful background information on the methods can also be found in these lecture notes (slides and exercises are also available).

### Demos

There are four demonstration programs for the provided filters and smoothers. The code of demonstrations and short introduction to them are given below. All of the demonstration programs are discussed completely in the documentation.

Demonstration programs for linear state-space models:

2D CWPA-model, 'kf_cpwa_demo'

Demonstration programs for non-linear state-space models:

Tracking a random sine signal, 'ekf_sine_demo'

UNGM-model, 'ungm_demo'

Bearings Only Tracking, 'bot_demo'

Reentry Vehicle Tracking, 'reentry_demo'

Demonstration programs for multiple model systems:

Tracking a Target with Simple Manouvers, 'imm_demo'

Coordinated Turn Model, 'ct_demo'

Bearings Only Tracking of a Manouvering Target, 'botm_demo'

### Contents

EKF/UKF toolbox for Matlab 7.x Version 1.3, August 12, 2011 Copyright (C) 2002-2011 Simo Särkkä,2007-2011 Jouni Hartikainen 2010-2011 Arno Solin History: 12.08.2011 AS/JH Updated for version 1.3 04.09.2007 JH/SS Updated for version 1.1 06.08.2007 JH Updated for version 1.0 This software is distributed under the GNU General Public Licence (version 2 or later); please refer to the file Licence.txt, included with the software, for details. Kalman filtering KF_PREDICT Perform Kalman Filter prediction step KF_UPDATE Kalman Filter update step KF_LHOOD Kalman Filter measurement likelihood RTS_SMOOTH Rauch-Tung-Striebel Smoother TF_SMOOTH Smoother based on combination of two Kalman filters Extended Kalman filtering EKF_PREDICT1 1st order Extended Kalman Filter prediction step EKF_UPDATE1 1st order Extended Kalman Filter update step EKF_PREDICT2 2nd order Extended Kalman Filter prediction step EKF_UPDATE2 2nd order Extended Kalman Filter update step ERTS_SMOOTH1 1st order Extended RTS Smoother ETF_SMOOTH1 Smoother based on two 1st order extended Kalman filters Nonlinear transform based filtering UT_WEIGHTS Generate weights for sigma points using the summation form UT_MWEIGHTS Generate weights for sigma points using the matrix form UT_SIGMAS Generate Sigma Points for Unscented Transformation UT_TRANSFORM Makes the Unscented Transformation of x and y UKF_PREDICT1 Nonaugmented UKF prediction step UKF_UPDATE1 Nonaugmented UKF update step UKF_PREDICT2 Augmented (state and process noise) UKF prediction step UKF_UPDATE2 Augmented (state and measurement noise) UKF update step UKF_PREDICT3 Augmented (state, process and measurement noise) UKF prediction step UKF_UPDATE3 Augmented (state, process and measurement noise) UKF update step URTS_SMOOTH1 Nonaugmented unscented RTS-smoother URTS_SMOOTH2 Augmented unscented RTS-smoother UTF_SMOOTH1 Smoother based on combination of two unscented Kalman filters GH_TRANSFORM Gauss-Hermite transform of random variables GHKF_PREDICT Gauss-Hermite Kalman filter prediction step GHKF_UPDATE Gauss-Hermite Kalman filter update step GHRTS_SMOOTH Additive form Gauss-Hermite Rauch-Tung-Striebel smoother CKF_TRANSFORM Cubature Kalman filter transform of random variables CKF_PREDICT Cubature Kalman filter prediction step CKF_UPDATE Cubature Kalman filter update step CRTS_SMOOTH Additive form cubature Rauch-Tung-Striebel smoother Multiple Model Filtering IMM_PREDICT IMM filter prediction step IMM_UPDATE IMM filter update step IMM_SMOOTH IMM smoothing EIMM_PREDICT IMM-EKF filter prediction step EIMM_UPDATE IMM-EKF filter update step EIMM_SMOOTH IMM-EKF smoothing UIMM_PREDICT IMM-UKF filter prediction step UIMM_UPDATE IMM-UKF filter update step UIMM_SMOOTH IMM-UKF smoothing Misc. GAUSS_PDF Multivariate Gaussian PDF GAUSS_RND Multivariate Gaussian random variables LTI_INT Integrate LTI ODE with Gaussian Noise LTI_DISC Discretize LTI ODE with Gaussian Noise RK4 Runge-Kutta integration DER_CHECK Check derivatives using finite differences SCHOL Positive semidefinite matrix Cholesky factorization /DEMOS/ /KF_CWPA_DEMO/ KF_CWPA_DEMO CWPA model demonstration with Kalman filter /EKF_SINE_DEMO/ EKF_SINE_F Dynamic model function (needed by the augmented UKF) EKF_SINE_H Measurement model function EKF_SINE_DH_DX Jacobian of the measurement model EKF_SINE_D2H_DX2 Hessian of the measurement model EKF_SINE_DEMO Random Sine Signal demonstration /UNGM_DEMO/ UNGM_F Dynamic model function UNGM_DF_DX Jacobian of the dynamic model UNGM_D2F_DX2 Hessian of the dynamic model (not used) UNGM_H Measurement model function UNGM_DH_DX Jacobian of the measurement model UNGM_D2H_DX2 Hessian of the measurement model (not used) UNGM_DEMO UNGM model demonstration /BOT_DEMO/ BOT_H Measurement model function BOT_DH_DX 1st order derivative of the measurement model BOT_D2H_DX2 2nd order derivative of the measurement model BOT_DEMO_ALL BOT demo with EKF and UKF EKFS_BOT_DEMO BOT demo with EKF UKFS_BOT_DEMO BOT demo with UKF GHKFS_BOT_DEMO BOT demo with GHKF CKFS_BOT_DEMO BOT demo with CKF /REENTRY_DEMO/ REENTRY_F Dynamic model function REENTRY_DF_DX Jacobian of the dynamic model REENTRY_H Measurement model function REENTRY_DH_DX Jacobian of the measurement model REENTRY_IF Inverse prediction of the dynamic model REENTRY_COND Generates condition numbers for simulation data MAKE_REENTRY_DATA Generates the simulation data for reentry dynamics REENTRY_DEMO Reentry Vehicle Tracking demonstration /IMM_DEMO/ IMM_DEMO Tracking a Target with Simple Manouvers demonstration /EIMM_DEMO/ F_TURN Dynamic model function for the coordinated turn model F_TURN_DX Jacobian of the coordinated turn model's dynamic model F_TURN_INV Inverse dynamics of the coordinated turn model CT_DEMO Coordinated Turn Model demonstration BOT_H Measurement model function BOT_DH_DX 1st order derivative of the measurement model BOT_D2H_DX2 2nd order derivative of the measurement model BOTM_DEMO Bearings Only Tracking of a Manouvering Target Demonstration Demos currently included in the toolbox, but not documented: /KF_SINE_DEMO/ KF_SINE_DEMO Sine signal demonstration with Kalman filter