I understand the basic principles involved in Kalman filtering and I have spend some time implementing several algorithms in Matlab. The problem I'm facing now is to check if the algorithm and my code actually do the right thing. I know that there are statistical tests, such as the NEES test (= normalized estimation error squared) and the NIS test (= normalized innovation squared). Their principle is described in the literature, but the description of implementation and interpretation of results is pretty vague. In the simulations I currently do, I can't get the NEES test to pass even for the perfectly matched model (while the NIS test normally passes)!
So my question is: Does anyone have tips, tricks, hints or references how to check the consistency of the filter and debug the code if needed (especially regarding the interpretation of test outcomes)?
I'm sorry that this question is a bit vague, I hope it still conforms with the board rules.
(Remark: I first posted this on signal processing but figured it might receive more attention here. If more detailed information is needed, I'm happy to make my post more specific!)