linear-algebra


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
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:
Correct small errors in P on each iteration (formally not correct, but works nicely). I have successfully used the simplistic P = 1/2 (P + P') with real matrices in the past, but there are more ellaborate schemes.
Use a square-root Kalman filter, or any other formulation that improves stability. Since they keep and update a kind of square root of P, the assymetries are not a problem anymore. They also reduce the positive definite problem in general.
Go to 64 bit FP arithmetic. Much more stable than using single precision.
Improve numerical conditioning by scaling some variables. Large magnitude differences between numbers worsen the inaccuracies, so if P mixes in the diagonal values in the order of 10^+3 with other values in the order of 10^-6, then change the unit of the latter variable to micro-whatever to reduce the gap.
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.

Related Links

How to represent a bus ride in linear programming?
Matlab : How do I ensure that the covariance matrix is positive definite when using Kalman Filter
Computing singular values vs eigenvalues when you have the choice
Solving of a linear system with parameters
Upper Division Linear Algebra
positive solutions to a homogeneous linear system
Use LispLab within AutoCAD
Eigenvalues of large symmetric matrices
Eigen - directly compute log determinant of huge sparse matrix
Calculating the coefficients of a separable state
When to use eigen and when to use Blas
Numerical Economic Computability Algorithm
Index of a maximum element in TensorFlow tensor
Efficiently multiplying matrix with transpose using cuBlas
Linear Algebra Derivation in Gertler-Karadi (2015) AEJ
Lapack Orthonormalization Function for Rectangular Matrix

Categories

HOME
fabricjs
paraview
webdriver
mjml
obfuscation
bitbucket-api
seo
newrelic
yandex
jquery-ui
title
pattern-matching
octave
plist
ipmitool
gruntfile
capistrano3
dynamic-sql
firefox-addon
delphi-xe5
bourbon
selinux
lilypond
articulate-storyline
squashfs
aggregation
expressionengine3
data.stackexchange.com
itunes
syntax-highlighting
intersystems-cache
wcag
exchangewebservices
boost-asio
aws-codecommit
weather
left-join
playstation-portable
r-grid
memory-address
vue-chartjs
slacktextviewcontroller
getlasterror
swagger-php
latitude-longitude
magento-1.9.2.4
alphabetical
sessionstorage
flatmap
gdata
attributeerror
avcapturedevice
drupal-theming
rfc3339
phpdbg
flask-restful
builder
facebook-pixel
stdmap
yii2-user
edit
filehandle
skin
cmp
mathcad
javafx-css
redbeard-ios
flex4.6
file-uri
resourcemanager
stream-processing
phpwebsocket
asyncdisplaykit
jbase
character-replacement
boomerang
java-money
qt5.2
oracle-spatial
microsoft-reporting
fuelcms
dulwich
sql-server-data-tools
mirror
pyobjc
teamcity-9.1
cakephp-2.7
apache-spark-1.3
nsmenu
named-parameters
paste
decoupling
xmltodict
dtmf
kogrid
curb
rmiregistry
appjs
predicatebuilder
hibernateexception
fsevents
filemerge
umra
uipagecontrol
addchild
web-garden
isapi-extension
zen
blender-2.49
django-piston
filesystemobject
purepdf
visualj#
sun
httpcookie

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App