# The Naked Scientists Forum

### Author Topic: How can I calculate displacement from time series acceleration data?  (Read 21871 times)

#### timabram

• First timers
• Posts: 1
##### How can I calculate displacement from time series acceleration data?
« on: 07/06/2006 08:26:04 »
Hi,

Does any one have a simple algorithm for translating time series acceleration data to displacement.  All any one ever seems to have is "just double integrate the data" ......  ???  double integrate what?

I also understand that this process results in drift of the result, this isn't so important to me as I am recording accelerations from a bouy to record wave height, and all im interested in is the mean wave height of the data series.

The data is recorded from a simple single axis accelerometer and resulting in the following data:

Time ; Acceleration in m/s^2

at a frequency of 20Hz - although this can be changed.

Any Ideas of VB code samples would be great.

Tim

Mod: Edited to rephrase your title as a question.
« Last Edit: 11/03/2010 03:50:56 by JP »

#### Soul Surfer

• Neilep Level Member
• Posts: 3345
• keep banging the rocks together
##### Re: How can I calculate displacement from time series acceleration data?
« Reply #1 on: 09/06/2006 11:22:45 »
The simple answer to this is that you need to learn about integration and some basic dynamics because the answer you have been given is correct and there is no substitute for the process of integration.

If something starts moving it displacement from its original position depends on the velocity that it is moving and the time that it has been moving  (velocity is distance moved in a given time)so velocity is the rate of change of distance.  However this velocity is not contstant and the rate of change of velocity is acceleration  in other words a position is in meteres from a particular spot, a velocity is meteres per second and an acceletation is meteres per second per second.  This process is called differentiation.  The inverse of this process is integration.

You are particularly interested in wave motion where something starts at rest accelerates moves a bit comes to rest and moves back again this involves continually varying, position, velocity and acceleration.

Learn, create, test and tell
evolution rules in all things
God says so!

#### daveshorts

• Moderator
• Neilep Level Member
• Posts: 2583
• Physics, Experiments
##### Re: How can I calculate displacement from time series acceleration data?
« Reply #2 on: 09/06/2006 12:58:43 »
A very quick overview:

Integration is a way of converting a rate of change in x to x itself.

A a change of velocity (Δv) over a period of time (dt) is the average acceleration over this period of time * dt

so if you have equally spaced acceleration data the change of velocity between each point could be approximated to be the accelleration at each point. so Δv = a * dt

so the total change of velocity will be from point 1 to point n will be approximately:
Δv = a_1 * dt + a_2 * dt + a_3 * dt ....a_n *dt

the relation of velocity to position is the same as acceleration to velocity.

You will find that average errors in position will build up over time, as errors build up. There must be more sophisticated methods of dealing with this.

the most trivial way of doing this is to
« Last Edit: 09/06/2006 12:59:26 by daveshorts »

#### wolfpackdiver

• First timers
• Posts: 1
##### Re: How can I calculate displacement from time series acceleration data?
« Reply #3 on: 10/03/2010 20:38:28 »
Double integration of raw acceleration data is a pretty poor estimate for displacement.  The reason is that at each integration, you are compounding the noise in the data.  If you are dead set on working in the time-domain, the best results come from the following steps.
1. Remove the mean from your sample (now have zero-mean sample)
2. Integrate once to get velocity using some rule (trapezoidal, etc.)
3. Remove the mean from the velocity
4. Integrate again to get displacement.
5. Remove the mean. Note, if you plot this, you will see drift over time.
6. To eliminate (some to most) of the drift (trend), use a least squares fit (high degree depending on data) to determine polynomial coefficients.
7. Remove the least squares polynomial function from your data.

A much better way to get displacement from acceleration data is to work in the frequency domain.  To do this, follow these steps...

1. Remove the mean from the accel. data
2. Take the Fourier transform (FFT) of the accel. data.
3. Convert the transformed accel. data to displacement data by dividing each element by -omega^2, where omega is the frequency band.
4. Now take the inverse FFT to get back to the time-domain and scale your result.

This will give you a much better estimate of displacement.  Hope this helps..

#### LeeE

• Neilep Level Member
• Posts: 3382
##### How can I calculate displacement from time series acceleration data?
« Reply #4 on: 12/03/2010 00:24:37 »
Hmm... sounds as though the old and simple

s= ut + 1/2 at2

might suit, where s is the displacement, u is the initial velocity, a is the acceleration and t the period between samples.  You'll also need to work out the new value for u, for each sample, of course, but that's trivial, assuming you have an initial velocity to start with.

#### The Naked Scientists Forum

##### How can I calculate displacement from time series acceleration data?
« Reply #4 on: 12/03/2010 00:24:37 »