matlabkalman-filterimukinematics

Kalman Filter Velocity data looking too similar to position data


Creating a Kalman filter on Matlab that intakes Accelerometer and Angular Velocity measurements from phone IMU sensors, and filters it, then calculates the position and velocity. My question is on if I am going about calculating the position and velocity wrong, of if this is a good result but it looks strange for some reason?

af = [Accxf, Accyf, Acczf];

vf = af .* dt;
rf = .5 * af .* (dt^2);

af is the filtered acceleration data, with dt being 0.1 seconds. I just followed basic kinematics equations, is that the wrong way to calculate it? Initial velocity and positioned are calculated the same way but from the raw data, charts are provided.

If this isn't the issue, where should I be looking to figure this out? My only other guess is maybe its an issue with the state variables.

Tried changing sensor data, adjusting kinematic formulas, and debugging. Expected different looking results for position and velocity.


Solution

  • Using cumtrapz() instead of the equations of motion is the correct method. This way, it can use the change over time, not just an incrementing figure. James Tursa has an excellent display of why this is the correct method.