# Extended Kalman Filter: Jacobian matrix

I still have some doubts about the EKF algorithm, especially in the definition of the measurement matrix H. Normally, we use the matrix H during the update step to calculate the innovation residual, the innovation covariance, the near-optimal Kalman gain, and the updated covariance estimate. Sometimes we used the Jacobian of H in the calculation of the innovation residual as follows: innovation residual

sometimes we use directly the following equation without the Jacobian (to calculate the distance and the bearing angle to a landmark):

distance and bearing angle from the robot to a landmark

But then we use the Jacobian H to calculate the innovation covariance, the near-optimal Kalman gain, and the updated covariance estimate. I found this confusing. Could you please help me out?

Another similar point is the transition state matrix F, sometimes it is defined as an identity matrix but other times as a Jacobian matrix of the transition state model!

What does the EKF do?

The EKF is used to estimate distribution of the states given the control inputs and the measurements. The EKF assumes the distribution is Gaussian and is parametrized by the mean and covariance matrix. I believe your confusion is the difference between propagating the mean and propagating the covariance matrix.

The EKF can be separated in a prediction step and and update step. Let the mean and covariance after the prediction step be denoted using $$-$$ superscript (i.e., $$x_k^-$$, $$\Sigma_k^{-}$$) and the mean and covariance after the update step be denoted using $$+$$ superscript (i.e., $$x_k^+$$, $$\Sigma_k^{+}$$). The prediction step is the application of the process model, so the distribution given the states and control inputs, and the update step is the application of the observation model, so the distribution given the states and measurements.

Process Model:

The mean may be propagated for the prediction step using the process model, so $$x_{k+1}^- = f(x_k, u_k)$$. This means that the nonlinear process model may be used for the prediction step. However, the covariance matrix for the prediction step uses a first-order approximation. Thus, the covariance for the prediction step is given by $$\Sigma_{k+1}^- = F_k \Sigma_k^+F_k^T + Q_k$$ where $$Q$$ is the covariance of the process noise. The nonlinear process model cannot be directly applied to the covariance matrix. This is the reason the Jacobians are used instead of the function $$f$$ for propagating the covariance matrix.

Observation Model:

Similarly, the expected measurements can be computed using the nonlinear observation, so $$\hat{z}_k = h(x_k)$$ where $$\hat{z}_k$$ denotes the expected measurement. This is the measurement we expect given the mean of our belief. This is why we use $$h$$ for computing the residual instead of the Jacobian. However, a first-order approximation is used for updating the covariance matrix, so we need to use the Jacobian (i.e., $$H$$ matrix for the update step). Similarly, we can't apply the nonlinear observation model to the covariance matrix.

Note:

Keep in mind, the $$F$$ matrix is the Jacobian of the process model $$f$$, and the $$H$$ matrix is the Jacobian of the observation model $$h$$, so $$F$$ is only the identify if the Jacobian is the identity. This is dependent on the particular equations defining $$f$$.

• Hi,thank you, Ralff, for your answer! Commented Apr 14, 2021 at 12:06