# Kalman filter: updating the state-transition model

I am currently reading lots of material on the Kalman filter (in order to do some experiments), and there is something that I don't get, and I can't get a clear understanding.

I'll stick to the Wikipedia page notation, $$\mathbf{F}_k$$ is the state transition model and defines how the state goes from step $$k$$ to step $$k+1$$.

As I read it, there is a subscript, which means to me that it can change over time (and that makes sense).

However, the "update" step does not describe how I get the new estimation of $$\mathbf{F}$$.

Example: Consider a robot moving (more or less) randomly in a 2D space. At first, say I have a 45° line motion. If speed is constant, my state is described by $$\left[ x \: y \: vx \: vy \right]$$, and I'll have $$\begin{bmatrix} x_{k+1} \\ y_{k+1} \\ vx_{k+1} \\ vy_{k+1} \end{bmatrix} = \begin{bmatrix} 1 & 0 & \Delta t & 0 \\ 0 & 1 & 0 & \Delta t \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x_k \\ y_k \\ vx_k \\ vy_k \end{bmatrix}$$

But when the robot changes directions, then that state matrix is not valid anymore!

How do I get the updated $$\mathbf{F}$$ matrix? What is the point I missed?

Edit to clarify: I have some sample working code that is able to provide a good tracking, and it keeps the same state-mode matrix all the way. But I just don't understand how that can work.

Edit2: forgot to mention, but the estimation of the covariance matrix $$\mathbf{P}$$ at a given step also relies on $$\mathbf{F}$$: $$\mathbf{P} = \mathbf{F} \: \mathbf{P} \: \mathbf{F}^{-1} + \mathbf{Q}$$ How can that possibly work if the motion (expressed by the state-mode matrix $$\mathbf{F}$$) is incorrect? I really must have something wrong here...

• The state transition matrix is given exogeneously; it is an input to the Kalman filter. It is not "estimated" or "updated" by the Kalman filter. I don't know anything about robot movement, it may require a different perspective than the one you've described here to use the Kalman filter for that. Commented Nov 21, 2021 at 18:48
• Thanks for your comment. This is a mystery for me: how can the filter provide a good estimate (and it does!) with an incorrect state update model.
– kebs
Commented Nov 21, 2021 at 19:00

1. "which means to me that it can change over time". Yes, the state-space coefficients can indeed depend on time. However, to be more precise, it is the time interval $$\Delta t_k$$ the coefficient usually depends on instead of time $$t$$. For example, if you have uniform $$\Delta t_k$$ for all $$k$$'s, then $$F$$ is independent of $$k$$.

2. "However, the "update" step does not describe how I get the new estimation of $$F$$". The Kalman update step does not estimate $$F$$.

3. "But when the robot changes directions, then that state matrix is not valid anymore! How do I get the updated $$F$$ matrix? What is the point I missed?". The model you are showing is a Wiener velocity model which describes any target motion in terms of position and velocity. When the robot changes its direction, the model is still a valid model, simply because you have forgotten the noise term. Denote $$z = [x\,y\,v_x\,v_y]$$. The complete model is $$z_k = F \, z_{k-1} + q_{k-1}$$, where $$q_{k-1} \sim N(0, Q)$$ is a Gaussian r.v. with covariance $$Q$$ depending only on $$\Delta t_k$$. This noise term $$q$$ accounts for the permutation/uncertainty of target's position and velocity. Without $$q$$, your model target will go along a straight line, and of course the direction will not change. With $$q$$, your model target will have a random trajectory with direction changes. You can try simulate the trajectory and see.

Think of the dynamic model as a prior on your target. The Kalman filter update step's job is to "correct" the prediction from the prior model by using the likelihood model (i.e., your measurement model) and measurement/data.

1. "How do I get the updated $$F$$ matrix? What is the point I missed". If you really want to get more precise $$F$$ (and $$Q$$), you may parameterise $$F$$ ($$Q$$) with some parameters, say, $$\theta$$, and get $$F(\theta)$$ (and $$Q(\theta)$$). Then you can estiamte $$\theta$$ by performing maximum likelihood estimation.
• Thanks for that detailed answer!
– kebs
Commented Nov 22, 2021 at 20:23

$$F_k$$ can change over time, but doesn't need to. The wikipedia article is suggesting that $$F_k$$ can change, perhaps as part of your filter's design (i.e. you may choose how it evolves in your design). But often, $$F_0 = F_1 = ... F_k$$.

So you are doing nothing wrong, just you are seeing a generalized syntax.

• Thanks for you answer. As I said in comment above, I don't understand how the filter can provide a good estimate (and it -usually-does) with an incorrect state update model!!
– kebs
Commented Nov 21, 2021 at 19:02
• Why do you think the state matrix isn't valid anymore? Commented Nov 21, 2021 at 19:40
• Well, if the object changes directions (say, 180° turn), then we go from $x_{k+1} = x_k + \Delta t. vx$ to $x_{k+1} = x_k - \Delta t. vx$.
– kebs
Commented Nov 21, 2021 at 20:09
• Arg... I think I am starting to understand were my assumptions are bad... Let me check.
– kebs
Commented Nov 21, 2021 at 20:11
• Please fill us in on your solution - it will help others! Commented Nov 22, 2021 at 2:35