The Kalman filter is one of those interesting algorithms which are completely impenetrable if you don't have the underlying math background (multivariate statisics, in this case), but become utterly obvious in in hindsight when you do.
Every "why" question about the plain old Kalman filter can be answered by looking at its problem statement, which is to design a filter that:
- Assumes zero-mean Gaussian noise driving the processes and measurement error.
- Assumes the states of a linear system is being estimated.
- Assumes that -- aside from noise -- the system parameters and inputs are perfectly known.
- Defines "optimal" as being that solution which, at each step, gives the state estimate whose expected value is the smallest Euclidean distance from the system's actual states (i.e., sum-of-squares).
Most of the time, when the operation of the Kalman filter isn't intuitive, it's because your intuition comes from real world systems, and real world systems aren't linear, real-world noise isn't Gaussian, and real world system models aren't 100% accurate.
Do I see it correctly that Pk decreases with each iteration because (1−KH)≤1? Assuming that this is true, doesn't this mean that the uncertainty in the state estimation becomes very small with enough time steps and eventually tends towards Q since the values within KH become smaller with each step?
For constant $Q$ and $R$ it does decrease asymptotically, but it doesn't tend toward $Q$ because of the update step $P_k = (1-KH)P^-_k$ -- and $K$ depends on $R$. Basically, high $R$ (high measurement noise) increases the uncertainty in the state estimation. Do a web search on "Steady State Kalman" for much more information than will fit into a StackExchange post.
If we are at a point where the values in P
are very small, which yes means that the uncertainty in our estimated state and the estimated measurement is very small, then the influence of the measurements is probably very small as the Kalman gain becomes small - I.e. even if the innovation zk−Hx−k
is very large, we trust the prediction of the model, although perhaps the true observation would have been correct?
If that is the case, then $Q$ or $R$ or both are wrong. $Q$ and $R$ aren't chosen arbitrarily -- they must match the problem. If (and only if) they do, then the Kalman is optimal in the least-squares sense.
Suppose the values in Pk
are very small and we get measurements that are very different from the previous ones, but (for whatever reason) are true. The predictions of the kalman filter will deviate strongly from this and still have a small variance, simply because according to the previous data the prediction of the KL is more probable than the measurement? I.e. At a certain point we have only predictions with a small variance, no matter whether they correspond to the truth and I see now way how the values in Pk could grow again. But I think they should grow because if the innovation is big for some iterations, then there must be something wrong with the predictions
Then $Q$ or $R$ or both are wrong, or the probability distributions aren't Gaussian and the assumptions of a plain old Kalman filter don't hold.
The Kalman filter assumes that the system whose states are being estimated is linear, that $Q$ and $R$ are known, and that the processes they describe are Gaussian. If they aren't known (or are not matched to the problem at hand) then the Kalman won't give optimal results. If the processes are not Gaussian then the Kalman filter will be the best linear filter in the mean-squared sense, but it won't be the best filter overall, and there may be some other sense (i.e., min-max) where it isn't optimal.
You seem to either be confused about the necessary condition (sometimes impossible to meet) that $Q$ and $R$ are known, or that the plain old Kalman assumes Gaussian processes.
If, for example, your measurement usually has a Gaussian error, but occasionally has a really bad measurement (i.e., it's got some almost-Gaussian long-tailed distribution), then you may be able to get close to an optimal filter with a filter that's a plain old Kalman at its core, but which monitors the error between $\hat z$ and the measured $z$, and if that error is much larger than predicted by $H\ P\ H^T$ you substitute in a much larger $R$ than "normal".
OTOH, if your system usually runs along smoothly, but every once in a while it acts like it got hit with a rock, you could again detect that $\hat z$ is not matching measurement, and substitute in a large $Q$ and recompute $P$ (especially if the "got hit by a rock" mechanism is known, and has a known effect on $P$).
Neither of these is indicative of problems with the plain old Kalman filter per se -- just that it is only optimal in one sense, and only for a certain model, and only when reality actually matches the model that you use to generate the filter. Stray outside of the bounds where it is the right answer and -- you'll get the wrong answer.