Trying to use the Kálmán filter to find the steady state of time series data.
Can see Kálmán algorithm as follows for a scalar:
Predict:
x(k|k-1) = Ax(k-1|k-1) + B U(k)
P(k|k-1) = AP(k-1|k-1) + W(k)
Update:
y(k) = c x(k) + v(k)
K(k) = P(k|k-1)C/(CP(k|k-1) + v(k)
P(k|k) = (1-K(k)C)P(k|k-1)
I am trying to understand the difference between P(k|k) and P(k|k-1).
When this is implemented, do P(k|k) becomes the P(k|k-1) in the next iteration? If yes, does the error covariance W(k) in P(k|k-1) is not included in calculations or are they different terms?
Both prediction
and update
steps in your example belong to the iteration k
.
From the perspective of the iteration k
you have following covariances:
P(k-1|k-1)
- a posteriori covariance at iteration k-1
(after the measurement processing)
P(k|k-1)
- a priori covariance at iteration k
(after the prediction step, before the measurement processing)
P(k|k)
- a posteriori covariance at iteration k
(after the measurement processing)
So the difference between P(k|k)
and P(k|k-1)
is that P(k|k)
involves the information from the last measurement and P(k|k-1)
does not.
Here is the same thing for two different iterations:
iteration k-1
:
P(k-1|k-2) = P(k-2|k-2) + W(k-1)
P(k-1|k-1) = (1-K(k-1))P(k-1|k-2)
iteration k
:
P(k|k-1) = P(k-1|k-1) + W(k)
P(k|k) = (1-K(k))P(k|k-1)