\begin{eqnarray} X_k &=& F X_{k-1}+ \omega_k \nonumber \\ Z_k &=& H X_k + \nu_k \end{eqnarray}

The first equation is state exploration equation and second one measurement equation. Point to be noted, I dont have $Bu$ term in my state equation unlike common state exploration equation. Here, I was trying to generate the data (forward problem) to Kalman filter application using both the above equations with known process noise $\omega_k$ and measuremenet noise $\nu_k$. First I compute $Xk$ and then plug into second equation to calculate $Z_k$.

During the synthetic data generation, my $X_k$ values are going to NaN as it is recusive. Could some one help me to understand the problem and also any suggestion on Kalman filter examples where the data is generated via these two equations and then a Kalman filter is used to estimate the states $\hat{X}_k$? The main goal is use the known $\omega_k$ and $\nu_k$ in forward problem data generation and then use the same values in Q and R matrix to solve with Kalman filter.

I looked into several examples in the internet and I see data is randomly generated and the it is solved with Kalman filter to estimate the states by randomly creating/tuning Q and R matrix.


2 Answers 2


Your equations look OK. If I were you I would check out the eigenvalues of matrix A. numpy can do it for you but I don't know on what you are simulating. If you have one eigenvalue of modulus superior to one, then your system is unstable.

  • $\begingroup$ Hi, If eig(A) are complex conjugate pairs, then can I assume that system is stable? $\endgroup$
    – Sagar
    Feb 13 at 9:51
  • $\begingroup$ @Sagar Nope. If $\lambda$ is an eigenvalue you have to have $|\lambda|<1$. In short it comes from the fact that in order to compute $X_n$ you have to compute $A^{n}$. Therefore, if you put $A$ in its triangle form on the diagonal you have all you eigenvalues put to the power n as $\lambda^{n}$. In other words, your system is as stable as $\lambda^{n}$ with $\lambda$ the eigenvalue of A with the biggest modulus Then if one of them is bigger than one, $X_n$ diverges. So check for the modulus. $\endgroup$
    – NokiYola
    Feb 13 at 10:33

The model equation of the Kalman Filter: $ \boldsymbol{x}_{k} = F \boldsymbol{x}_{k} + \boldsymbol{w}_{k} $ is basically like a Fixed Point Iteration operator.

Hence it requires the operator, $ F $ to have its eigen values within the unit circle.
In case it doesn't, it means that after enough iterations (Depends on the value of the eigen value and the initial state) it will diverge numerically.

Usually, in the context of Kalman Filter, we use pre defined models with their respective $ F $. In the common templates the model matrix is stable.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.