This is part of my program whereby I use the RK4 method to inetgrate from acceleration to position.
The acceleration is a value output from an IMU
dt used is 0.01 or 1/100
Is this code that i wrote correct?
It looks okay to me except that you are mixing floats and doubles (9.80665 and then 0.5f). In numerical methods, you probably want to avoid using 32bit floating point numbers and stick to doubles.
It's been a LONG time since I've done Runge-Kutta so I can't really correct you on your implementation of the method.
Why not feed the integrator an equation that you already know the exact solution for,
such as a particle moving in a uniform gravitational field with no air resistance (parabola) ?
Then if the integrator follows the exact curve closely you are probably OK
Well the problem in writing this program is that the acceleration input is from an IMU which would mean that it is discrete. And it is not time dependent,thus i am not able to work out an equation to put into the integrator. I tried the euler integrator but there are horrible errors