필터 지우기
필터 지우기

Non positive state covariance using squared unscented Kalman Filter

조회 수: 24 (최근 30일)
Jonas Gentner
Jonas Gentner 2022년 1월 2일
댓글: Huy 2024년 6월 6일
Hi,
i am trying to use an unscented kalman filter for state and parameter estimation of an ode.
And i am using the UKF-Function from Yi Ciao posted here on Matlab Central: https://de.mathworks.com/matlabcentral/fileexchange/18217-learning-the-unscented-kalman-filter
When trying to run this i get always the same error, that says that my Covariance Matrix P (or S for the squared UKF) becomes non positive definite and therefore the cholesky factorisation does not work. I have already tried a modified version of Ciao's code that implements a squared UKF found on github (https://github.com/JJHu1993/sr-ukf/blob/master/ukf.m).
For me it is unclear what is causing a non positive definite covariance at all. And if that is something that can be fixed by adjusting the tunable parameters (alpha,ki,beta). I found out that for both (ukf and sr-ukf) the code works if i choose alpha = 1 however then the state estimation is really bad. For any value for alpha smaller than 1 i receive the mentioned error. I tried this for two different models/functions and got the same behaviour.
I would be very glad if someone could answer me these questions:
  1. What is typically causing the covariance to become non-positive definite?
  2. Is this something that depends on the tunable parameters or is there a problem with the used model or even the observability?
  3. What is the typical procedure for this problem?
Thanks a lot in advance.
  댓글 수: 1
Huy
Huy 2024년 6월 6일
Dear Jonas,
I can understand your difficulty for this issue!
It used to be my largest concern when I first met UKF!
You can use this tiny function from Mr. John D'Errico here to deal with it but please read the Review session with my comment - Huy:
You can add nearestSPD function into the UKF function of Mr. Yi Cao and add 1 more code line following below:
function X=sigmas(x,P,c)
%Sigma points around reference point
%Inputs:
% x: reference point
% P: covariance
% c: coefficient
%Output:
% X: Sigma points
P = nearestSPD(P);
A = c*chol(P)';
Y = x(:,ones(1,numel(x)));
X = [x Y+A Y-A];
Hope this solution can solve your problem!

댓글을 달려면 로그인하십시오.

답변 (1개)

Neelanshu
Neelanshu 2024년 1월 30일
Hi Jonas,
I understand from your query that you are interested in finding out why the covariance matrix might become non-positive definite and whether tunable parameters affect it.
A covariance matrix becoming non-positive definite can be caused by several factors:
  1. Numerical Instabilities: When the UKF equations are solved using finite-precision arithmetic (as is the case in computer implementations), small numerical errors can accumulate and lead to a loss of positive definiteness.
  2. Improper Tuning Parameters: The UKF has several parameters, such as alpha, beta, and kappa (or ki), which control the spread of the sigma points around the mean state estimate and the confidence in the process and measurement noise covariance matrices. If these are not chosen correctly, they can lead to an ill-conditioned covariance matrix.
  3. Model Mismatch: If the process model or the measurement model used in the UKF does not accurately represent the true system dynamics or measurement process, it can lead to incorrect covariance updates.
  4. Poor Observability: If the system or the measurements do not provide enough information to fully observe the state of the system, it can make the covariance matrix estimation unreliable.
Regarding the tunable parameters, when the system response to a varying parameter is slow, a larger value for alpha might be required to maintain stability. If you are encountering stability issues, you may consider working with the Square Root UKF, which is computationally more stable.
Hope this helps.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by