I'm relatively new to using Kalman filters. To get my feet wet, I'm working on a program simulating a sounding rocket with a barometric pressure sensor to determine apogee. I've taken "ideal" altitude data and overlaid white noise to approximate a noisy pressure sensor. I've been able to "guess" (hardcode) gain values that allow the filter to track the data relatively closely, however I'm having trouble determining the correct gains (to minimize the error covariance)..
Based on the white noise I've used, the barometric pressure sensor noise has a stdev=23.65 meters. I'm ballparking that the process noise only occurs in acceleration (wind, buffeting, etc), and has a stdev of
10 m/s^2. Therefore, the Q and R matricies that I'm using are:Q=[0 0 0 0 0 0 0 0 100]
R=[559.5 0 0 0 0 0 0 0 0]
However, when the program encounters the code to calculate the new gains K, I get the following: "Warning: Matrix is singular to working precision".
Can anyone spot a mistake I'm making in determining Q or R? Below is the "meat" of the filter I'm using, in case that is the source of the errors. (note: I'm defining P as a 3 X 3 X "time interval" matrix)
Thanks in advance for any help or advice! Dave
--------------------------------------------------- while i