## Extended Kalman Filters

Use an extended Kalman filter when object motion follows a nonlinear state equation or when the measurements are nonlinear functions of the state. A simple example is when the state or measurements of the object are calculated in spherical coordinates, such as azimuth, elevation, and range.

### State Update Model

The extended Kalman filter formulation linearizes the state equations. The updated state and covariance matrix remain linear functions of the previous state and covariance matrix. However, the state transition matrix in the linear Kalman filter is replaced by the Jacobian of the state equations. The Jacobian matrix is not constant but can depend on the state itself and time. To use the extended Kalman filter, you must specify both a state transition function and the Jacobian of the state transition function.

Assume there is a closed-form expression for the predicted state as a function of the previous state, controls, noise, and time.

${x}_{k+1}=f\left({x}_{k},{u}_{k},{w}_{k},t\right)$

The Jacobian of the predicted state with respect to the previous state is

${F}^{\left(x\right)}=\frac{\partial f}{\partial x}.$

The Jacobian of the predicted state with respect to the noise is

${F}^{\left(w\right)}=\frac{\partial f}{\partial {w}_{i}}.$

These functions take simpler forms when the noise enters linearly into the state update equation:

${x}_{k+1}=f\left({x}_{k},{u}_{k},t\right)+{w}_{k}$

In this case, F(w) = 1M.

### Measurement Model

In the extended Kalman filter, the measurement can be a nonlinear function of the state and the measurement noise.

${z}_{k}=h\left({x}_{k},{v}_{k},t\right)$

The Jacobian of the measurement with respect to the state is

${H}^{\left(x\right)}=\frac{\partial h}{\partial x}.$

The Jacobian of the measurement with respect to the measurement noise is

${H}^{\left(v\right)}=\frac{\partial h}{\partial v}.$

These functions take simpler forms when the noise enters linearly into the measurement equation:

${z}_{k}=h\left({x}_{k},t\right)+{v}_{k}$

In this case, H(v) = 1N.

### Extended Kalman Filter Loop

This extended Kalman filter loop is almost identical to the linear Kalman filter loop except that:

• The exact nonlinear state update and measurement functions are used whenever possible and the state transition matrix is replaced by the state Jacobian

• The measurement matrices are replaced by the appropriate Jacobians.

### Predefined Extended Kalman Filter Functions

The toolbox provides predefined state update and measurement functions to use in the extended Kalman filter.

Motion ModelFunction NameFunction Purpose
Constant velocityconstvelConstant-velocity state update model
constveljacConstant-velocity state update Jacobian
cvmeasConstant-velocity measurement model
cvmeasjacConstant-velocity measurement Jacobian
Constant accelerationconstaccConstant-acceleration state update model
constaccjacConstant-acceleration state update Jacobian
cameasConstant-acceleration measurement model
cameasjacConstant-acceleration measurement Jacobian
Constant turn rateconstturnConstant turn-rate state update model
constturnjacConstant turn-rate state update Jacobian
ctmeasConstant turn-rate measurement model
ctmeasjacConstant-turnrate measurement Jacobian