Non-overlapping state and measurement covariances in Kalman Filter I have implemented an EKF to track the state of a moving vehicle in 3D. My question is twofold:


*

*What happens if a measurement (e.g., for $y$ velocity) has a covariance that does not overlap with the current state and covariance? As an example, the measurement may have a value of 4 with an variance of 0.2, but the state vector's value for $y$ is 6 with a variance of 0.3. 

*The reason I ask question 1 is that I am getting negative values along the diagonal in my covariance matrix, signaling negative variances, which is clearly wrong. I have tried using the Joseph form update equation, i.e., 
$ P' = (I - KH)P(I-KH)^T + KRK^T$
However, my covariance matrix is showing negative values after the predict stage, not the update. The issue is with the projection of the covariance matrix using
$P' = APA^T + Q$
where $A$ is actually a Jacobian matrix of my transfer function. Interestingly, the Wikipedia article has this for an EKF:
$P' = AP + PA^T + Q$
I have raw debug output matrices that I can post if needed. The issue seems to be some negative covariance values between my linear and rotational velocities. Apologies in advance if this is a simple question. I'm familiar with Kalman Filters, but have never implemented an EKF that was this complex before.
 A: This type of situation can lead to negative Kalman gain matrices (K). This is why people usually implement some sort of sanity checking, if not more sophisticated data association or gating before updating their filters. That is, generally, a Kalman filter should not be provided measurements unless those measurements are consistent with the predicted state of the Kalman filter. Otherwise, negative gains can result and this can lead to non positive semi-definite covariance matrix results. This is especially true for the EKF, which is linearizing the Kalman filter around the predicted state and therefore assumes that the measurements being used to update the filter are consistent with the prediction model (A) being used. For more details and to verify your EKF approach, look at 8.28-8.30 here (https://www.dropbox.com/s/vv8kgd1yut732r7/EE690_08_Kinematic_Estimation_1_Spring04_1by1.pdf)
A: ayrton04, remember that gaussians curves are non-null from -inf to +inf. Therefore, there is always some overlap between two gaussians. In addition to the issue related by concipotech, you are may facing round-off problems, that causes you matrix to have negative values in the diagonal. Also due to round-off you may check you have a covariance matrix that is not symmetric, which, again, is clearly wrong. Wikipedia has a section about round-off issues on Kalman filter and an entire page about rounding standard.
