# Integrate acceleration to velocity and displacement

469 views (last 30 days)
tupac1971ful on 25 Mar 2016
Commented: Maaz Nayeem on 3 Feb 2020
I have taken 5000 measurements for acceleration with its acceleration's respective time. I created 2 vectors: for my acceleration measurements named "acceleration" and for time named "time". Which commands should i use exactly to intergate? I tried : velocity=cumtrapz(acceleration,time) & displacement=cumtrapz(velocity,time) and then to do the diagrams plot(time,velocity) & plot(time,displacement). Is that correct, or should i try another commands?

John D'Errico on 25 Mar 2016
Edited: John D'Errico on 25 Mar 2016
It looks close to good to me. Why do YOU think there is a problem?
Hint: Read the help for the tools you will use. In this case, cumtrapz.
When there are two arguments to cumtrapz, they should be in the order cumtrapz(x,y). Again, from the help, it shows this:
Z = cumtrapz(Y)
Z = cumtrapz(X,Y)
With only one argument, so an implicit X step of 1, you just pass in Y. With two arguments, i.e., acceleration and time, they must go in the proper order.
So, if you will integrate acceleration over time,
velocity = cumtrapz(time,acceleration);
Similarly, the second integral must have its arguments in the proper order.
##### 2 CommentsShowHide 1 older comment
Maaz Nayeem on 3 Feb 2020
check the graphs with seismo signal software.

Dr. Seis on 10 Apr 2016
Luke Laurence on 6 Feb 2018
Can you explain how your code converts between the different units? Example: Acceleration to Displacement.

Sumangali Sivakumaran on 25 Apr 2019
Though velocity = cumtrapz(acceleration,time); give some answers, velocity = cumtrapz(time,acceleration); is the correct way of doing.