How to take the double integral of a data set with respect to time

AI Thread Summary
To obtain displacement from acceleration data, one must integrate the acceleration over time. This involves calculating velocity by keeping a running total of acceleration and then calculating displacement by integrating velocity. For real-time computation on an Arduino, this method is feasible, but it requires careful handling of errors. A zero error in acceleration can accumulate, leading to significant inaccuracies in displacement over time. To mitigate this, a zero restoration algorithm is necessary to detect and correct biases, particularly by referencing known displacement values at specific points. When considering a scenario where acceleration is approximately constant over a finite time interval, the displacement can be accurately described using the formula (1/2) * acceleration * (Δt)^2, which accounts for the effects of constant acceleration over time. This approach ensures that the calculations reflect the physics of motion accurately.
Leo Liu
Messages
353
Reaction score
156
Question: Suppose I have a data file for the acceleration of an object after every ##
\Delta t_i##, how do I obtain the displacement of it?

Context: Integral in a PID loop, although not exactly what I am asking as one is sum of error: $$\int_0^T \int_0^T \ddot {\vec \theta(t)}dtdt$$
the other is displacement:
$$\int_0^T \left(\dot{\vec \theta(0)}+ \int_0^T \ddot {\vec \theta(t)}dt\right)dt$$

PS I found http://mathforcollege.com/nm/mws/gen/07int/mws_gen_int_spe_trapdiscrete.pdf but it is for single integral over discrete data.
 
Technology news on Phys.org
There are a variety of numerical integration algorithms. If you have a particular scientific subroutine package, you should check whether it has an appropriate subroutine. If you are using Excel, this is a simple example
 
FactChecker said:
There are a variety of numerical integration algorithms. If you have a particular scientific subroutine package, you should check whether it has an appropriate subroutine. If you are using Excel, this is a simple example
Can I do this on an Arduino? It needs to be computed real time.
 
Leo Liu said:
Can I do this on an Arduino? It needs to be computed real time.
That seems very different from integrating data in a file.
 
Leo Liu said:
Can I do this on an Arduino? It needs to be computed real time.
Yes.
Keep a running total of the acceleration, which is velocity.
Keep a running total of the velocity, which is displacement.

The problem you will have is that a zero error in the acceleration will accumulate until your displacement exceeds some sensible limit. There will need to be some zero restoration algorithm introduced. You have two unknown constants of integration at the start.
 
Baluncore said:
The problem you will have is that a zero error in the acceleration will accumulate until your displacement exceeds some sensible limit. There will need to be some zero restoration algorithm introduced.
Could you elaborate, please?
 
Errors accumulate with time.
A DC offset error in the acceleration will always bias and drive the velocity one way.
You will need to detect and cancel that error somehow, by knowing the actual displacement at a zero crossing or some ± reference or limit.
 
One more question:
Suppose the acceleration ##\ddot x## is approximately constant during a finite ##
\Delta t##, is the displacement due to this contribution best described by ##\frac 1 2 \ddot x (\Delta t)^2## or ##(\ddot x \Delta t)\Delta t##?
 
Back
Top