Kalman filter a posteriori estimate covariance matrix

In summary, the conversation discusses two methods for deriving the a posteriori estimate covariance matrix for a linear Kalman filter. Method one involves taking the derivative of the trace of the matrix, while method two involves substituting for the state and measurement errors. Both methods should result in the same matrix, but the conversation notes that they are giving different results. The speaker is unsure of where they may have made a mistake and is seeking input on the issue.
  • #1
ryan88
42
0
I am having some trouble deriving the a posteriori estimate covariance matrix for the linear Kalman filter. Below I have shown my workings for two methods. Method one is fine and gives the expected result. Method two is the way I tried to derive it initially before further expanding out terms to arrive at method one.

For completeness I have also included the equations for the model and the prediction and update stages of the filter.

Model
[itex]\mathbf{x}_{k}=\mathbf{A}_{k}\mathbf{x}_{k-1}+\mathbf{B}_{k}\mathbf{u}_{k}+\mathbf{G}_{k}\mathbf{q}_{k}[/itex]
[itex]\mathbf{z}_{k}=\mathbf{H}_{k}\mathbf{x}_{k}+\mathbf{r}_{k}[/itex]

Prediction
[itex]\hat{\mathbf{x}}_{k|k-1}=\mathbf{A}_{k}\hat{\mathbf{x}}_{k-1|k-1}+\mathbf{B}_{k}\mathbf{u}_{k}[/itex]
[itex]\hat{\mathbf{z}}_{k|k-1}=\mathbf{H}_{k}\hat{\mathbf{x}}_{k|k-1}[/itex]
[itex]\mathbf{P}_{k|k-1}=\text{cov}\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k-1}\right)=\mathbf{A}_{k}\mathbf{P}_{k-1|k-1}\mathbf{A}_{k}^{\text{T}}+\mathbf{G}_{k}\mathbf{Q}_{k}\mathbf{G}_{k}^{\text{T}}[/itex]

Update
[itex]\hat{\mathbf{x}}_{k|k}=\hat{\mathbf{x}}_{k|k-1}+\mathbf{K}_{k}\left(\mathbf{z}_{k}-\hat{\mathbf{z}}_{k|k-1}\right)[/itex]
[itex]\mathbf{S}_{k}=\text{cov}\left(\mathbf{z}_{k}-\hat{\mathbf{z}}_{k|k-1}\right)=\mathbf{H}_{k}\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}+\mathbf{R}_{k}[/itex]

A posteriori estimate covariance - method one
Definition of the a posteriori estimate covariance matrix:
[itex]\mathbf{P}_{k|k}=\text{cov}\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k}\right)[/itex]
Substituting for [itex]\hat{\mathbf{x}}_{k|k}[/itex]:
[itex]\mathbf{P}_{k|k}=\text{cov}\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k-1}-\mathbf{K}_{k}\left(\mathbf{z}_{k}-\hat{\mathbf{z}}_{k|k-1}\right)\right)[/itex]
Substituting for [itex]\mathbf{z}_{k}[/itex] and [itex]\hat{\mathbf{z}}_{k|k-1}[/itex]:
[itex]\mathbf{P}_{k|k}=\text{cov}\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k-1}-\mathbf{K}_{k}\left(\mathbf{H}_{k}\mathbf{x}_{k}+\mathbf{r}_{k}-\mathbf{H}_{k}\hat{\mathbf{x}}_{k|k-1}\right)\right)[/itex]
Collecting like terms:
[itex]\mathbf{P}_{k|k}=\text{cov}\left(\left(\mathbf{I}-\mathbf{K}_{k}\mathbf{H}_{k}\right)\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k-1}\right)-\mathbf{K}_{k}\mathbf{r}_{k}\right)[/itex]
Measurement noise and the a priori state estimate are uncorrelated:
[itex]\mathbf{P}_{k|k}=\left(\mathbf{I}-\mathbf{K}_{k}\mathbf{H}_{k}\right)\text{cov}\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k-1}\right)\left(\mathbf{I}-\mathbf{K}_{k}\mathbf{H}_{k}\right)^{\text{T}}+\mathbf{K}_{k}\text{cov}\left(\mathbf{r}_{k}\right)\mathbf{K}_{k}^{\text{T}}[/itex]
Substitute for [itex]\mathbf{P}_{k|k-1}[/itex] and use definition of [itex]\mathbf{R}_{k}[/itex]:
[itex]\mathbf{P}_{k|k}=\left(\mathbf{I}-\mathbf{K}_{k}\mathbf{H}_{k}\right)\mathbf{P}_{k|k-1}\left(\mathbf{I}-\mathbf{K}_{k}\mathbf{H}_{k}\right)^{\text{T}}+\mathbf{K}_{k}\mathbf{R}_{k}\mathbf{K}_{k}^{\text{T}}[/itex]
Expanding out terms:
[itex]\mathbf{P}_{k|k}=\mathbf{P}_{k|k-1}-\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}\mathbf{K}_{k}^{\text{T}}-\mathbf{K}_{k}\mathbf{H}_{k}\mathbf{P}_{k|k-1}+\mathbf{K}_{k}\left(\mathbf{H}_{k}\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}+\mathbf{R}_{k}\right)\mathbf{K}_{k}^{\text{T}}[/itex]
Substituting for [itex]\mathbf{S}_{k}[/itex]:
[itex]\mathbf{P}_{k|k}=\mathbf{P}_{k|k-1}-\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}\mathbf{K}_{k}^{\text{T}}-\mathbf{K}_{k}\mathbf{H}_{k}\mathbf{P}_{k|k-1}+\mathbf{K}_{k}\mathbf{S}_{k}\mathbf{K}_{k}^{\text{T}}[/itex]
Minimize by taking derivative and setting to zero:
[itex]\frac{\partial\;\text{tr}\left(\mathbf{P}_{k|k}\right)}{\partial\;\mathbf{K}_{k}}=-2\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}+2\mathbf{K}_{k}\mathbf{S}_{k}=0[/itex]
Rearrange for [itex]\mathbf{K}_{k}[/itex]:
[itex]\mathbf{K}_{k}=\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}\mathbf{S}_{k}^{-1}[/itex]
Multiply both sides by [itex]\mathbf{S}_{k}\mathbf{K}_{k}^{\text{T}}[/itex]:
[itex]\mathbf{K}_{k}\mathbf{S}_{k}\mathbf{K}_{k}^{\text{T}}=\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}\mathbf{S}_{k}^{-1}\mathbf{S}_{k}\mathbf{K}_{k}^{\text{T}}[/itex]
Substitute back into [itex]\mathbf{P}_{k|k}[/itex]:
[itex]\mathbf{P}_{k|k}=\mathbf{P}_{k|k-1}-\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}\mathbf{K}_{k}^{\text{T}}-\mathbf{K}_{k}\mathbf{H}_{k}\mathbf{P}_{k|k-1}+\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}\mathbf{K}_{k}^{\text{T}}[/itex]
Collect terms:
[itex]\mathbf{P}_{k|k}=\left(\mathbf{I}-\mathbf{K}_{k}\mathbf{H}_{k}\right)\mathbf{P}_{k|k-1}[/itex]

A posteriori estimate covariance - method two
Definition of the a posteriori estimate covariance matrix:
[itex]\mathbf{P}_{k|k}=\text{cov}\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k}\right)[/itex]
Substituting for [itex]\hat{\mathbf{x}}_{k|k}[/itex]:
[itex]\mathbf{P}_{k|k}=\text{cov}\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k-1}-\mathbf{K}_{k}\left(\mathbf{z}_{k}-\hat{\mathbf{z}}_{k|k-1}\right)\right)[/itex]
Measurement error and state error are uncorrelated:
[itex]\mathbf{P}_{k|k}=\text{cov}\left(\mathbf{x}_{k}-\hat{\mathbf{x}}_{k|k-1}\right)+\mathbf{K}_{k}\text{cov}\left(\mathbf{z}_{k}-\hat{\mathbf{z}}_{k|k-1}\right)\mathbf{K}_{k}^{\text{T}}[/itex]
Substitute for [itex]\mathbf{P}_{k|k-1}[/itex] and [itex]\mathbf{S}_{k}[/itex]
[itex]\mathbf{P}_{k|k}=\mathbf{P}_{k|k-1}+\mathbf{K}_{k}\mathbf{S}_{k}\mathbf{K}_{k}^{\text{T}}[/itex]
Minimize by taking derivative and setting to zero:
[itex]\frac{\partial\;\text{tr}\left(\mathbf{P}_{k|k}\right)}{\partial\;\mathbf{K}_{k}}=2\mathbf{K}_{k}\mathbf{S}_{k}=0[/itex]

These two approaches should be the same, but are clearly not giving the same results. Any ideas what I am doing wrong? I just can't see it...
 
Physics news on Phys.org
  • #2


First of all, it's important to note that both methods are valid and will give the same result. However, there is a small mistake in the second method that is causing the discrepancy.

In the second method, when substituting for \mathbf{P}_{k|k-1}, the term \mathbf{K}_{k}\mathbf{S}_{k}\mathbf{K}_{k}^{\text{T}} should be replaced with \mathbf{K}_{k}\mathbf{H}_{k}\mathbf{P}_{k|k-1}\mathbf{H}_{k}^{\text{T}}\mathbf{K}_{k}^{\text{T}}. This is because the measurement error and state error are uncorrelated, but the measurement and state variables are correlated through the Kalman gain.

Making this correction should lead to the same result as the first method.
 

1. What is a Kalman filter a posteriori estimate covariance matrix?

A Kalman filter a posteriori estimate covariance matrix is a mathematical tool used in statistical estimation to track the state of a system over time. It provides an estimate of the accuracy of the system's state based on a combination of the system's model and measured data.

2. How does a Kalman filter a posteriori estimate covariance matrix work?

A Kalman filter a posteriori estimate covariance matrix works by combining two sources of data: a prediction of the system's state based on its previous state and a measurement of the system's state from sensors. It then calculates a weighted average of these two sources to provide an accurate estimate of the system's current state.

3. What is the purpose of using a Kalman filter a posteriori estimate covariance matrix?

The purpose of using a Kalman filter a posteriori estimate covariance matrix is to improve the accuracy of a system's state estimation. By combining predictions and measurements, the filter can reduce the effects of noise and uncertainties in the system, resulting in a more accurate estimate of the system's state.

4. What factors affect the accuracy of a Kalman filter a posteriori estimate covariance matrix?

The accuracy of a Kalman filter a posteriori estimate covariance matrix can be affected by several factors, including the accuracy of the system's model, the quality of the sensor measurements, and the level of noise and uncertainty present in the system. The filter can also be affected by incorrect assumptions or errors in the system's model.

5. In what fields is a Kalman filter a posteriori estimate covariance matrix commonly used?

A Kalman filter a posteriori estimate covariance matrix is commonly used in various fields, including aerospace, engineering, robotics, and finance. It is often used in applications that require accurate estimation of a system's state, such as tracking the position of a moving object or predicting stock market trends.

Similar threads

  • Linear and Abstract Algebra
Replies
1
Views
790
  • Linear and Abstract Algebra
Replies
1
Views
928
  • Linear and Abstract Algebra
Replies
7
Views
2K
  • Classical Physics
Replies
2
Views
889
  • Advanced Physics Homework Help
Replies
0
Views
296
  • Quantum Physics
Replies
6
Views
1K
Replies
3
Views
1K
  • Topology and Analysis
Replies
9
Views
2K
  • Advanced Physics Homework Help
Replies
1
Views
918
  • Classical Physics
Replies
30
Views
2K
Back
Top