I have recently started working on the unscented Kalman filter. I coded the numerically stable version (i.e., square root Kalman filter) and used MATLAB for implementing. In the final update step, where we update the state covariance matrix using cholupdate
I get an error.
Pk = cholupdate(expected_S,K*Sy,'-')
Basically, expected_S'*expected_S-(K*Sy)*(K*Sy)'
is not positive semi-definite (where expected_P=expected_S'*expected_S;
) and so cholupdate
returns an error.
I cannot understand why this is happening in the square root implementation. (I have checked the derivations and coding didn't seem to find an error.)
PS: I am currently testing linear models on UKF just to check if its optimal for linear models, but I keep getting the above error (for local linear trend model).