I'm having some trouble implementing a Kalman filter in MATLAB. I have an Android phone connected sending data from accelerometer for 10 seconds. After i have the data I take out the x-axis vector. What I want after that is to get better readings using the Kalman filter.
The output I am looking for is both the acceleration and the velocity of the phone. When I run the code I get almost no change in acceleration (is between -0.5 and 0.5 m/s^2) and way to much change in velocity (increasing to very high numbers). The tests I have been running are when the phone is laying still on a table. So the correct values in acceleration and velocity should be 0.
The problem is that since i'm only measuring acceleration my state vector will be the same vector as the measurement vector with the only difference that i also have velocity in the state vector. Both the control input is the acceleration and the measurement is the acceleration.
So when I update my state vector the difference that is going to be multiplied with the Kalman gain is always zero.
So my question is: Should the measurement noise / the process noise be added to the measured acceleration "z" or should the noise be added to the state prediction vector?