## The **Kalman filter** (named after its inventor, Rudolf E. Kalman) is an efficient recursive computational solution for tracking a time-dependent state vector with *noisy* equations of motion in real time by the least-squares method. It is used to separate signal from noise so as to optimally predict changes in a modeled system with time. Kalman filtering is an important topic in control theory and control systems engineering. It is in a wide range of engineering applications from radar to computer vision. The filter was developed in papers by Swerling (1958), Kalman (1960) and Kalman and Bucy (1961). Edit

## What makes the Kalman filter particularly unique is that it is purely a time domain filter. Most filters (for example, a low-pass filter) are formulated in the frequency domain and then transformed back to the time domain for implementation. Edit

== Peter Swerling actually developed a similar algorithm earlier. Stanley Schmidt is generally credited with developing the first implementation of a Kalman filter. It was during a visit of Kalman to the NASA Ames Research Center that he saw the applicability of his ideas to the problem of trajectory estimation for the Apollo program, leading to its incorporation in the Apollo navigation computer. ==

## A wide variety of Kalman filters have now been developed, from Kalman's original formulation, now called the *simple* Kalman filter, to Schmidt's *extended* filter, the *information* filter, and a variety of *square-root* filters, developed by Bierman, Thornton and many others. Perhaps the most commonly used type of Kalman filter is the phase-locked loop now ubiquitous in radios, computers, and nearly any other type of video or communications equipment. Edit

## Kalman filter basics Edit

## The Kalman filter is used to estimate the state of a dynamic system from a series of noisy measurements. Edit

## In order to accomplish this the Kalman filter employs 3 (sometimes 4) *models*. The first model is called the state transition model. This model describes how the state is expected to change from one timestep to the next. This is necessary because the system is dynamic, which means its underlying state is always subject to change. In reality this model is an approximation to the true process which is driving the dynamics of system. Because the state transition model is an approximation, a second model called the process noise model, is used. This model is used to mask the errors caused by the approximation. The third model is called the observation model. This model describes how the estimation space maps into the observation space. For example, an estimate of a target being tracked may include the target's velocity even though only the target's position is measured, or perhaps the target's position is measured in polar co-ordinates, but the estimated position in cartesian co-ordinates. The last model describes how the state is expected to change in response to a given control input (the control-input model). Often the latter is not used, for example in target tracking applications, as the control inputs are obviously unknown in this case. As with the state transition model, this is generally an approximation. Edit

## The Kalman filter is a recursive estimator. This means that only estimated state from the previous time step and the current measurement are needed to compute the estimate for the current state. In contrast to batch estimation techniques, no history of observations and/or measurements are required. It has two phases: **Predict** and **Update**. The predict phase uses the estimate from the previous timestep to produce an estimate of the current state. In the update phase measurement information from the current timestep is used to refine this prediction to arrive at a new, more accurate (hopefully) estimate. Edit

## The Kalman filter assumes a linear state space whose state transition is of the following form Edit

## Edit

==

The state transition model ==

## Edit

## is applied to Edit

## Edit

## the previous state. Edit

## The process noise Edit

## Edit

## is the part of the state transition which is not modelled by the state transition model. The presence of process noise requires the use of a process noise model in the filter. The process noise at time *k* is assumed to be gaussian white noise with covariance Edit

## Edit

## . Edit

## The control input, Edit

## Edit

## is mapped into the estimation space by Edit

## Edit

## the control-input model. Edit

## The observation, assumed to be of the form Edit

## Edit

## is a function of the true state where Edit

## Edit

## is the observation model and Edit

## Edit

## is the observation noise at time *k* which is assumed to be gaussian white noise with covariance Edit

## Edit

==

==

## Kalman filter equations Edit

## The Kalman filter is used to obtain an estimate of the Edit

== of the true state using only measurements and control inputs ==

## . Edit

## **Predict** Edit

## Edit

==

==

## Edit

==

**Update** ==

## Edit

==

==

## Edit

==

==

## Edit

==

Scheme of the Kalman Filter ==

## Numerically stable update Edit

## The covariance update equation assumes the gain is computed exactly as Edit

## Edit

==

If due to computational error the gain is inexact the following gives greater stability ==

## Edit

==

==

## Optimality Edit

## In the linear, gaussian case where the same linear models are used to drive the true and estimated states and where the noise parameters used in the filter are matched to the true noises perturbing the underlying state and observations, then the estimated covariance is a faithful representation of the true covariance of the state, that is, Edit

## Edit

==

Similary the following also holds this case ==

## Edit

==

In this case the Kalman filter is an optimal estimator in a least squares sense of the true state. ==

## Example Edit

## Tracking a 1D particle which is being perturbed with gaussian accelerations using a piece-wise constant process model. (Note: Time indices for *F*, *G*, *R* and *Q* have been dropped.) Edit

## The position and velocity of a point particle is described by the linear state space Edit

## Edit

==

where ==

## is the velocity, that is, the derivative of position. Edit

== Between the (*k* − 1)th and *k*th timestep the particle undergoes an acceleration
, ==

## Edit

## . Edit

## The updated position and velocity Edit

## Edit

==

where ==

## Edit

==

and ==

## Edit

==

follows logically from the Newtonian equations of motion. *T* is the time difference between the (*k* − 1)th and *k*th time step. (N.B. This process model requires that *T* is constant.) ==

## At each time step, a noisy measurement of the true position of the particle is made. Edit

## Edit

==

where ==

## Edit

==

and ==

## Edit

==

is the observation model. ==

## Using these measurements an estimate of the state can be computed. Edit

## The predicted state at the *k*th timestep using the estimated state from the (*k* − 1)th timestep is Edit

## Edit

==

and the predicted covariance is ==

## Edit

==

The predicted state and covariance are updated with the measurement and measurement (co)variance. ==

## The measurement innovation (or residual) Edit

## Edit

==

is the difference between the actual and predicted measurements, while the innovation (residual) covariance ==

## Edit

==

is the sum of the predicted covariance and the measurement covariance. The Kalman gain ==

## Edit

## is the ratio between the predicted covariance and the residual covariance. Edit

## The updated state estimate Edit

## Edit

==

is the predicted state plus the measurement innovation weighted by the Kalman gain. The updated estimated covariance is ==

## Edit

==

where ==

## Edit

==

The Kalman gain will converge to a steady-state position if Q and R are time-invariant. The steady-state Kalman-gain can then be precomputed. This will reduce the Kalman-filter to an ordinary observer; which is computationally simpler. ==

## DerivationEdit

== The Kalman filter can be derived in several ways. The one presented here uses probability theory. The true state is assumed to be an unobserved Markov process, and the measurements are the observed states of a hidden Markov model. ==

## Hidden Markov Model Edit

## Because of the Markov assumption, the true state is conditionally dependant only on the previous state and is independent of all previous states. Edit

## Edit

==

Similarly the measurement a the *k*-th timestep is dependent only upon the current state and is independent of all other states. ==

## Edit

==

Using these assumptions the probability distribution over all states of the HMM can be written simply as: ==

## Edit

==

However, when the Kalman filter to estimate the state **x** the probability distribution of interest is that associated with the current states conditioned on the measurements upto the current timestep. (This is achieved by marginalising out the previous states and dividing by the probability of the measurement set.) ==

## This leads to the *predict* and *update* steps of the Kalman filter written probabilistically. The probability distribution associated with the predicted state is product of the probability distribution associated with the transition from the (*k* - 1)th timestep to the *k*th and the probability distribution associated with the previous state, with the true state at (*k* - 1) integrated out. Edit

## Edit

==

The measurement set upto time *t* is ==

## Edit

==

The probability distribution of updated is proportional to the product of the measurement likelihood and the predicted state. ==

## Edit

==

The denominator ==

## Edit

## is an unimportant normalisation term. Edit

## The remaining probability density functions are PDF: Edit

## Edit

==

==

## Edit

==

==

## Edit

==

Note that the PDF at the previous timestep is inductively assumed to be the estimated state and covariance. This is justified because, as an optimal estimator, the Kalman filter makes best use of the measurements, therefore the PDF for ==

== given the measurements
*is* the Kalman filter estimate. ==

## Information filterEdit

## In the Information filter, or Inverse Convariance filter, the estimated covariance and estimated state are replaced by the information matrix and information vector respectively. Edit

## Edit

## Edit

==

Similarly the predicted covariance and state have equivalent information forms, ==

## Edit

## Edit

==

as have the measurement covariance and measurement vector. ==

## Edit

## Edit

==

The information update now becomes a trivial sum. ==

## Edit

## Edit

==

The main advantage of the information filter is that *N* measurements can be filtered at each timestep simply by summing their information matrices and vectors. ==

## Edit

## Edit

==

To predict the information filter the information matrix and vector can be converted back to their state space equivalents, or alternatively the information space prediction can be used. ==

## Edit

==

==

## Edit

## Edit

## Edit

==

==

## Edit

==

Note that if *F* and *Q* are time invariant these values can be cached. Note also that *F* and *Q* need to be invertible. ==

## Non-linear filtersEdit

## The basic Kalman filter is limited to a linear assumption. However most non-trivial systems are non-linear. The non-linearity can be associated either with the process model or with the observation model or with both. Edit

## Extended Kalman filter Edit

## In the Extended Kalman filter (EKF) the state transition and observation models need not be linear functions of the state but may instead be (differentiable) functions. Edit

## Edit

==

==

## Edit

==

The function *f* can be used to compute the predicted state from the previous estimate and similarly the function *h* can be used to compute the predicted measurement from the predicted state. However *f* and *h* cannot be applied to the covariance directly. Instead a matrix of partial derivatives (the Jacobian) is computed. ==

## Edit

==

==

## Edit

==

At each timestep the Jacobian is evaluated with current predicted states. These matrices can be used in the Kalman filter equations. This process essentially linearises the non-linear function around the current estimate. ==

## This results in the following extended Kalman filter equations: Edit

## **Predict** Edit

## Edit

==

==

## Edit

==

**Update** ==

## Edit

==

==

## Edit

==

==

## Edit

==

==

## Unscented Kalman filter Edit

## The Extended Kalman filter gives particularly poor performance on highly non-linear functions because only the mean is propagated through the non-linearity. The Unscented Kalman filter (UKF) [JU97] uses a deterministic sampling technique to pick a minimal set of sample points (called sigma points) around the mean. These sigma points are then propagated through the non-linear functions and the estimated covariance is then recovered. The result is a filter which more accurately captures the true mean and covariance. (This can be verified using Monte Carlo sampling.) In addition, this technique removes the requirement to calculate Jacobians, which for complex functions can be a difficult task in-itself. Edit

## **Predict** Edit

## As with the EFK, the UKF prediction can be used independently from the UKF update, in combination with a linear (or indeed EKF) update, or visa versa. Edit

## The estimated state and covariance are augmented with the mean and covariance of the process noise. Edit

## Edit

==

==

## Edit

==

A a set of 2*L*+1 sigma points is derived from the augmented state and covariance where *L* is the dimension of the augmented state. ==

## The sigma points are propagated through the transition function *f*. Edit

## Edit

==

The weighted sigma points are recombined to produce the predicted state and covariance. ==

## Edit

==

==

## Edit

==

Where the weights for the state and covariance are given are: ==

## Edit

## Edit

## Edit

## Edit

==

Typical values for
,
, and ==

## are Edit

## , 2 and 0 respectively. (These values should suffice for most purposes.) Edit

## **Update** Edit

## The predicted state and covariance are augmented as before, except now with the mean and covariance of the measurement noise. Edit

## Edit

==

==

## Edit

==

As before, a set of 2*L*+1 sigma points is derived from the augmented state and covariance where *L* is the dimension of the augmented state. ==

## Alternatively if the UKF prediction has been used the sigma points themselves can be augmented along the following lines Edit

## Edit

==

where ==

## Edit

==

The sigma points are projected through the observation function *h*. ==

## Edit

==

The weighted sigma points are recombined to produce the predicted measurement and predicted measurement covariance. ==

## Edit

==

==

## Edit

==

The state-measurement cross-correlation matrix, ==

## Edit

==

is used to compute the UKF Kalman gain. ==

## Edit

==

As with the Kalman filter, the updated state is the predicted state plus the innovation weighted by the Kalman gain, ==

## Edit

==

And the updated covariance is the predicted covariance, minus the predicted measurement covariance, weighted by the Kalman gain. ==

## Edit

==

==

## ApplicationsEdit

## Inertial guidance system Edit

## Autopilot Edit

## Edit

## Simultaneous localization and mapping Edit

## ReferencesEdit

## Kalman, R. E. A New Approach to Linear Filtering and Prediction Problems, *Transactions of the ASME - Journal of Basic Engineering* Vol. 82: pp. 35-45 (1960) Edit

## Kalman, R. E., Bucy R. S., New Results in Linear Filtering and Prediction Theory, *Transactions of the ASME - Journal of Basic Engineering* Vol. 83: pp. 95-107 (1961) Edit

## [JU97] Julier, Simon J. and Jeffery K. Uhlmann. A New Extension of the Kalman Filter to nonlinear Systems. In The Proceedings of AeroSense: The 11th International Symposium on Aerospace/Defense Sensing,Simulation and Controls, Multi Sensor Fusion, Tracking and Resource Management II, SPIE, 1997. Edit

## See also Edit

== Compare with: Wiener filter, and the multimodal Particle filter estimator. ==