linear-algebracovariancesvdeigenvaluekalman-filter

Matlab : How do I ensure that the covariance matrix is positive definite when using Kalman Filter


For complex valued data, I am finding it hard to ensure that the covariance matrix is positive definite. Taking an example,

P =

  10.0000 +10.0000i        0                  0          
        0            10.0000 +10.0000i        0          
        0                  0            10.0000 +10.0000i

I can check for positive definiteness of P using the cholesky or the eigenvalues explained below.

(A)

[R1,p1] = chol(P)

R1 =

     []


p1 =

     1

Since p1 > 0, A is not positive definite

(B) Using eigen values : if the eigenvalues are positive, then P should be positive definite.

[r p]=eig(P)

r =

     1     0     0
     0     1     0
     0     0     1


p =

  10.0000 +10.0000i        0                  0          
        0            10.0000 +10.0000i        0          
    0                  0            10.0000 +10.0000i

However, doing svd(P) gives all positive eigenalues !! Where am I going wrong and what should I do to prevent the P matrix from becoming non positive definite. During run time and real world scenarios it is very hard to ensure the postive definiteness of P. Is there a hack or a way out? Thank you very much


Solution

  • Checking positive definiteness on complex matrices:

    First of all, an answer to this question at math.stackexchange says that:

    A necessary and sufficient condition for a complex matrix A to be positive definite is that the Hermitian part A_H = 1/2·(A+A^H) is positive definite, where A^H denotes the conjugate transpose.

    Why P matrix becomes non-positive definite:

    Then, on the question of why P loses its "positive-definiteness", the usual culprit is floating point representation/arithmetic.

    Standard Kalman filter algorithm can show numerical stability problems in some sensitive operations as taking the inverse of matrix S when calculating Kalman gain, or when applying optimizations as using the simplified expresion for error covariance on the update step P+ = (I - K·H)·P-.

    There are other sources of error, as a buggy implementation or using wrong data (e.g. defining process/measure covariance matrices that are not positive definite themselves).

    How to avoid the problem:

    I will focus in the first source of error: numerical stability. There are a number of alternatives commonly used to make Kalman filters more stable and avoid the covariance matrix problem:

    Using one or a combination of these factors could work. However, I have not worked with Kalman filters in the complex domain, so let me know how it works for your case.