Jump to content
  • Advertisement
Sign in to follow this  
yahastu

Kalman filter without using matrix inverse

This topic is 2137 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Kalman filter predict/update equations are here:

https://en.wikipedia.org/wiki/Kalman_filter

 

I have implemented the Kalman filter and it works nicely.  However,  the standard Kalman equations are written naively in terms of the matrix inverse.  In particular, the S matrix (innovation covariance) is inverted in order to compute K (the gain matrix):

S = H P H^t + R
K = P H^t S^{-1}

The gain matrix (K) is finally used to update the state estimate (x) and estimated covariance of the state (P) as follows:

x += K y
P -= K H P

I would like to update 'x' and 'P' without computing the matrix inverse S^{-1}.

In the following reference, a method is given "for calculating (H P H^t + R)^{-1} H in the conventional Kalman filter without explicitly computing an inverse." (using U D U^T, or LDL^t)  Of course, (H P H^t + R)^{-1} is equal to S^{-1}, but this confuses me because "S^{-1} H" does not appear in the computation of K....and so, it is not clear to me, how the value of S^{-1}H can be used to compute K.

Reference:
'Kalman Filtering; Theory and Practice Using MATLAB', second edition, by Grewal and Andrews
http://books.google.com/books?id=sZbxLK-NKb0C&q=+without+explicitly+inverting#v=snippet&q=without%20explicitly%20inverting&f=false
(click the second link)

Edited by yahastu

Share this post


Link to post
Share on other sites
Advertisement

In these types of recursive algorithms involving updates and matrix inverse you can often eliminate the inverse with the Matrix Inversion Lemma, also known as the Woodbury identity or variations thereof. It basically gives you a formula for recursively updating the inverse of a matrix directly instead of updating the matrix and then inverting it every iteration.

 

That information may help you on the way, although I am not even sure if it is possible to use the MIL in this case.

Share this post


Link to post
Share on other sites

Of course, (H P H^t + R)^{-1} is equal to S^{-1}, but this confuses me because "S^{-1} H" does not appear in the computation of K....and so, it is not clear to me, how the value of S^{-1}H can be used to compute K.


I haven't read the formulas for the Kalman filter in a while, so I might be missing something, but if S is symmetric (which it should be, since it's a covariance matrix of some sort), the transpose of (S^{-1} H) is (H^t S^{-1}), which you can use to compute K.

Share this post


Link to post
Share on other sites

Kalman filter predict/update equations are here:

https://en.wikipedia.org/wiki/Kalman_filter

 

I have implemented the Kalman filter and it works nicely.  However,  the standard Kalman equations are written naively in terms of the matrix inverse.  In particular, the S matrix (innovation covariance) is inverted in order to compute K (the gain matrix):

S = H P H^t + R
K = P H^t S^{-1}

The gain matrix (K) is finally used to update the state estimate (x) and estimated covariance of the state (P) as follows:

x += K y
P -= K H P

I would like to update 'x' and 'P' without computing the matrix inverse S^{-1}.

In the following reference, a method is given "for calculating (H P H^t + R)^{-1} H in the conventional Kalman filter without explicitly computing an inverse." (using U D U^T, or LDL^t)  Of course, (H P H^t + R)^{-1} is equal to S^{-1}, but this confuses me because "S^{-1} H" does not appear in the computation of K....and so, it is not clear to me, how the value of S^{-1}H can be used to compute K.

Reference:
'Kalman Filtering; Theory and Practice Using MATLAB', second edition, by Grewal and Andrews
http://books.google.com/books?id=sZbxLK-NKb0C&q=+without+explicitly+inverting#v=snippet&q=without%20explicitly%20inverting&f=false
(click the second link)

 

You have K = P H^t S^{-1} = P X^t, where X is the solution to the linear system of equations

S X = H

now this could be solved by calculating X = S^-1 H which is, however, not the most efficient solution.

Since in your case S is positive definite, you can use the Cholesky decomposition to solve it.

More information on wikipedia.

Share this post


Link to post
Share on other sites

There are three forms of the Kalman filter.  You might consider using another form,

 

There's the covariance form, which you are using.  This requires a matrix inversion at each step, but gives you the state estimate directly.  This is the form most people know.

 

There's also an information form, which works with the inverse of the covariance matrix (called the (Fisher) information matrix).  This does not require a matrix inversion at each step -- but the state estimate is not directly accessible. Instead of a state estimate, you have an information vector.  You can reconstruct the state estimate from the information vector, but this requires a matrix inverse.  One nice thing about this form is that you can specify a totally noninformative prior for the state by setting the initial information matrix to zero.  Also, there are reasonable assumptions under which information matrices are sparse (but covariance matrices are not), so this form can sometimes be efficient for really large problems with sparsity.

 

Finally, there's the square root form.  Here, instead of working with either the covariance or its inverse, you work with a matrix square root of the covariance matrix (e.g., its Cholesky decomposition), and actually never construct the covariance matrix directly.  This is usually the most computationally efficient filter. [EDIT: Actually, it's the most expensive; what it is is numerically stable.]  It also avoid the problems of ensuring that your covariance or information matrix remain positive definite in the face of roundoff errors, since it's impossible to represent anything but positive definite matrices this way [EDIT: this is largely the point of this form].

Edited by Emergent

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!