December 3rd, 2013, 10:39 pm
There can be several places and several reasons why a matrix can become singular. Unless the model used is truly linear, your process noise matrix, Q, should not be all zeros. For nonlinear models, having even small non-zero values on the diagonal of Q can help prevent singular matrices from forming and it helps ensure that the filter does not ignore the measurements.Another place to be careful is the calculation of the Kalman gain: [$]\frac{VarY*H^T}{H*VarY*H^T + R}[$]. Do not explicitly compute inverse in this equation. Instead solve a system of equations (Ax=b) whereA=[$](H*VarY*H^T + R)^T[$]x=[$]KalmanGain^T[$]b=[$](VarY*H^T)^T[$]If your solver can handle solving (xA=b), then the outermost transposes can be removed.If your development language has symmetric matrices, then use it to represent InitVarY, VarY, R, and Q.