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.
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.
The Jacobian of the predicted state with respect to the previous state is
The Jacobian of the predicted state with respect to the noise is
These functions take simpler forms when the noise enters linearly into the state update equation:
In this case, F(w) = 1M.
In the extended Kalman filter, the measurement can be a nonlinear function of the state and the measurement noise.
The Jacobian of the measurement with respect to the state is
The Jacobian of the measurement with respect to the measurement noise is
These functions take simpler forms when the noise enters linearly into the measurement equation:
In this case, H(v) = 1N.
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.
Sensor Fusion and Tracking Toolbox™ provides predefined state update and measurement functions to use in the extended Kalman filter.
Motion Model | Function Name | Function Purpose |
---|---|---|
Constant velocity | constvel | Constant-velocity state update model |
constveljac | Constant-velocity state update Jacobian | |
cvmeas | Constant-velocity measurement model | |
cvmeasjac | Constant-velocity measurement Jacobian | |
Constant acceleration | constacc | Constant-acceleration state update model |
constaccjac | Constant-acceleration state update Jacobian | |
cameas | Constant-acceleration measurement model | |
cameasjac | Constant-acceleration measurement Jacobian | |
Constant turn rate | constturn | Constant turn-rate state update model |
constturnjac | Constant turn-rate state update Jacobian | |
ctmeas | Constant turn-rate measurement model | |
ctmeasjac | Constant-turnrate measurement Jacobian |