How can I get more accurate results when I am integrating Time and Acceleration with Cumtrapz?

33 views (last 30 days)
Bob
Bob on 6 Apr 2016
Answered: Prashanth Ragam on 2 May 2016
My Data consists of Time, Acceleration, Velocity and Displacement.
I want to calculate the equation xr.
xr = (m2*x2ddot-b1*x1dot+b1*x2dot-k1*x1+(k1+k2)*x2)/k2;
When I load my Data from excel and calculate the xr, my result is correct. When I load only Time and Acceleration from excel, integrate with cumtrapz for Velocity and Displacement and then calculate the xr, my result is wrong (inaccurate).

Answers (2)

Dr. Seis
Dr. Seis on 10 Apr 2016
Edited: Dr. Seis on 11 Apr 2016
I do not use time domain methods to compute the integral or derivative of timeseries data, but you are free to use the code in my post here for frequency domain method:
Update: I should also mention that before integration (whether using time or frequency domain techniques), I will typically remove any linear/constant trends in my data using the DETREND function. This removes the amplitude at DC (or zero-frequency) and any other relatively low-frequency noise introduced/boosted by performing the integration.
  3 Comments
Dr. Seis
Dr. Seis on 11 Apr 2016
You need to run the DETREND tool on the acceleration data first. Something like:
x1ddot = xlsread('Data','B2:B2501'); % Acceleration (m/s^2)
x1ddot_detrend = detrend(x1ddot);
x1dot = iomega(x1ddot_detrend,0.0180,3,2); % Velocity (m/s)
x1 = iomega(x1ddot_detrend,0.0180,3,1); % Displacement (m)
x2ddot = xlsread('Data','E2:E2501'); % Acceleration (m/s^2)
x2ddot_detrend = detrend(x2ddot);
x2dot = iomega(x2ddot_detrend,0.0180,3,2); % Velocity (m/s)
x2 = iomega(x2ddot_detrend,0.0180,3,1); % Displacement (m)
Note: You can place the detrended acceleration data inside the function for outputting both the velocity and displacement data (just change the input/output data types as shown). You may also need to run a high-pass filter to get rid of other low-frequency noise.
Other Note: Even after detrending and filtering produces a good match to the shape of the output velocity/displacement data, there will still be some bulk shift that will need to be applied for better alignment. Always some unknown constant ("C") that you may need to add on to your result after integration.

Sign in to comment.


Prashanth Ragam
Prashanth Ragam on 2 May 2016
hi DR.Seis I have blasting acceleration data around 1000 values with 0.1s delay.can I wan convert acceleration data into velocity...if it is possible, please suggest the code.

Community Treasure Hunt

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

Start Hunting!

Translated by