12

I am using the Kalman Filter opencv library to use the Kalman estimator capabilities.

My program does not enforce real time recursion. My question is, when the transition matrix has elements dependent on the time step, do I have to update the transition matrix every time use it (in predict or correct) to reflect the time passed since last recursion?

Edit: The reason I ask this is because the filter works well with no corrections on the transition matrix but it does not when I update the time steps.

Paulo Neves
  • 869
  • 11
  • 21

1 Answers1

18

Many descriptions of the Kalman Filter write the transition matrix as F as if it's a constant. As you have discovered, you have to update it (along with Q) on each update in some cases, such as with a variable timestep.

Consider a simple system of position and velocity, with

F = [ 1 1 ] [ x ]
    [ 0 1 ] [ v ]

So at each step x = x + v (position updates according to velocity) and v = v (no change in velocity).

This is fine, as long as your velocity is in units of length / timestep. If your timestep varies, or if you express your velocity in a more typical unit like length / s, you will need to write F like this:

F = [ 1 dt ] [ x ]
    [ 0 1  ] [ v ]

This means you must compute a new value for F whenever your timestep changes (or every time, if there is no set schedule).

Keep in mind that you are also adding in the process noise Q on each update, so it likely needs to be scaled by time as well.

Ben Jackson
  • 78,375
  • 8
  • 86
  • 141
  • Quite a bit later I came to the same conclusion. On the other hand I could have not explained it more concisely. – Paulo Neves Oct 13 '14 at 10:16