Kalman Filter applied to linear discrete time process and interpretation of the estimated covariance matrix

36 Views Asked by At

I want to have a deeper understanding of the discrete time Kalman Filter.

As a part of this I have modeled a forced, damped, mass spring system numerically in the Jupyter Notebook available here: https://colab.research.google.com/drive/14c3-moLnPlbWArnT5I0_MEW6zytYW6Mv

The model of the system is:

$\ddot{x} = -k (x - x_0) - \mu v + f sin(5t)$

Where:

$x$ is the spring position, unit $[\mathrm{m}]$.

$k$ is the spring constant, unit $[\mathrm{N/m}]$.

$\mu$ is the viscous friction, unit $[\mathrm{Ns/m}]$.

$x_0$ is the spring equilibrium position, unit $[\mathrm{m}]$.

$f$ is the external force amplitude, unit $[\mathrm{N}]$.

$\ddot{x}$ is the double derivative of $x$ with respect to time, or $\frac{\mathrm{d}^2 x}{\mathrm{d} t^2}$.

The question is: To my understanding this process should be optimally estimated by the Kalman filter. My understanding is that this implies that the filter estimate $\hat{x}$ should be between $x \pm \sigma_x$ with a probability of 0.682.

In my numerical experiments the position estimate follows this relation perfectly, but the velocity estimate does not at all. I am struggling to understand the exact cause of this. The notebook explains each step of the numerics, and shows how the distribution of the position estimate and velocity estimate differ. You can edit and comment in the notebook to test changes and explain where things go wrong.

Any help to shed light on this would be greatly appreciated.

1

There are 1 best solutions below

1
On

Your Kalman Filter seems to be tracking the position and velocity fairly well, so I don't think it is broken.

Have you looked at the offdiagonal elements of your covariance matrix? If these are nonzero, that would mean there is correlation between the position and velocity errors.