Integrating experimental acceleration data to get velocity and position

I have a 801x1 double of acceleration values of a dampened spring mass system. I need to integrate the data twice so I can plot a velocity and position graph as well as do some computations on the velocity and position matrices. The acceleration is in terms of sample number, which was measured at 50Hz. Thank you.

1 Comment

Is there a way I can fit a exponentially decaying (dampened) sinusoidal wave to my data and the taking the indefinite integral of that function?

Sign in to comment.

Answers (2)

Can't you just do an accumulated sum on the acceleration (with appropriate scaling) to get velocity, and then an accumulated sum on the velocity to get position? E.g.,
a = your 801x1 acceleration vector
v = v0 + cumsum(a) * some_scaling_factor; % Scaling factor depends on units of "a" vector
p = p0 + cumsum(v);
Do you need to account for gravity?

1 Comment

The sum will approximate the definite integral. I want the indefinite integral except I only have data points and not an equation. Maybe I am misunderstanding what you're saying but that will not output the instantaneous velocity then position at every time.

Sign in to comment.

I would use cumtrapz for the integrations. You may not need to filter out (Signal Processing Toolbox) the noise (if the noise is significant) unless it adversely affects the integrations.

2 Comments

cumtrapz makes trapezoids out of the data and approximates the area of the trapezoids while summing them for the entirety of the data, which is a method for approximating the definite integral. I need to take the indefinite integral of the data. Is there a way I can fit a exponentially decaying (dampened) sinusoidal wave to my data and the taking the indefinite integral of that function?
You have data and time vectors, each with a defined beginning and end. I do not understand your wanting an indefinite integral.
You can easily construct a mathematical model of the acceleration in your spring-mass-damper system using the Symbolic Math Toolbox, fit it to your data using any of several parameter estimation routines in MATLAB (and at least three Toolboxes), and then using the estimated parameters in the function, integrate it analytically to get velocity and position if you want to.
If you already have the spring, mass, and damper parameters, you don’t even need to do the parameter estimation. Just derive the mathematics of your system, plug in the parameters, and you’re set.

Sign in to comment.

Asked:

on 12 Nov 2015

Commented:

on 13 Nov 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!