Extended Kalman filter example in R

Last week’s post about the Kalman filter focused on the derivation of the algorithm. Today I will continue with the extended Kalman filter (EKF) that can deal also with nonlinearities. According to Wikipedia the EKF has been considered the de facto standard in the theory of nonlinear state estimation, navigation systems and GPS. Kalman filterI had the following dynamic linear model for the Kalman filter last week: $$\begin{align} x_{t+1} & = A x_t + w_t,\quad w_t \sim N(0,Q)\