# Acceleration to Displacement

I'm doing an experimental program.

I've a smartphone fixed on the car dashboard with a support, during the travel i read from an application some value from inertial sensor,

Precisely I read,

Accelerometer Data Time (at fixed interval) of each registration in second.

So now i would to pass from vertical acceleration to vertical displacement, to do this I should do a double integration,

I tried, euler method. From initial condition like

$v_{0} = 0.$ this is initial velocity at time zero.

$x_{0} = 0.$ this is initial position at time zero.

define,

$\Delta T =$ registration interval. (in my case 0,04s)

then for each registration made, i do:

$v_{i} = v_{i-1} + ay_{i} *\Delta T.$

$x_{i} = x_{i-1} + v_{i} * \Delta T.$

where i represent the current, and i-1 precedent.

But the chart that I get is not very realistic, in fact both the speed and the displacement are only grow, instead the effect that I had to get is that the vertical displacement came out as something similar to the acceleration graph.

Given that applying this procedure, I also a high error, it is possible that the graph is only growing, and I do not see any kind of vertical oscillation?

I also read the Kalman filter can be applied in advance to clean the signal, could be a solution?

Or should I change the method of integration and switch to the Euler from Runge Kutta? (The lastes, however, I have not the slightest idea of ​​how it could be set)

Here is an example of the data registered. It can be helpful

## 1 Answer

Some advice I have for you:

1) Be sure to convert your time values from milliseconds to seconds 2) Don't assume a constant time interval. Calculate it as the difference between each consecutive time measurement 3) Take your acceleration values to be the difference between the accelerometer reading and the "Gravity Y" column. This way you will see the actual oscillation instead of a constant acceleration in one direction.