Linear Model

\begin{equation} z_n=0.5z_{n-1}+\xi_{n-1} \end{equation}

with $\xi_{n-1}\sim N(0,B)$ and $z_{0}\sim N(0,0.4)$

Observations \begin{equation} y_n=z_n+\eta_n \end{equation} $\eta_{n-1}\sim N(0,R)$

Kalman filter

Forecast formulas: \begin{align} \hat{m}_{n+1}&=Am_n\\ \hat{C}_{n+1}&=AC_nA^{\top}+B \end{align}

Analysis formulas \begin{align} m_{n+1}&=\hat{m}_{n+1}-K_{n+1}(H\hat{m}_{n+1}-y_{n+1})\\ C_{n+1}&=\hat{C}_{n+1}-K_{n+1}H\hat{C}_{n+1} \end{align}

with Kalman gain \begin{equation} K_{n+1}=\hat{C}_{n+1}H^{\top}(R+H\hat{C}_{n+1}H^{\top})^{-1} \end{equation}

Exercise: Please implement the Kalman filter for the example above


In [ ]:


In [ ]:


In [ ]:

Lorenz equations

\begin{align} \dot{x}&=\sigma(y-x)\\ \dot{y}&=x(\rho-z)-y\\ \dot{z}&=xy-\beta z \end{align}

Ensemble Kalman Filter \begin{equation} z^i_{n+1}=\hat{z}^i_{n+1}-K_{n+1}(H\hat{z}^i_{n+1}-\tilde{y}^i_{n+1}) \end{equation}

\begin{align} m_{n}&\approx\frac{1}{M}\sum^M_{i=1}z^i_{n}\\ C_{n}&\approx\frac{1}{M}\sum^M_{i=1}(z^i_{n}-m_{n})(z^i_{n}-m_{n})^{\top} \end{align}

Exercise: Please implement the Ensemble Kalman filter for the Lorenz equation


In [ ]:


In [ ]:

Particle filter

Exercise: Please implement the Particle filter with resampling for the Lorenz equation


In [ ]: