MATLAB: Integrating Acceleration Data Matlab

integrationmatlab functionnumerical integrationplotting

Hi there,
I have the acceleration vs. time data that is attached. When I plot it, I get the following:
I want to integrate it to get the Velocity vs. Time graph but I do not know how to do this. I have tried trapz() but it only gives some weird linear graph.
If someone could let me know how to do this that would be greatly appreciated.
Cheers.

Best Answer

Try
v = cumtrapz(X2(:,1),X2(:,2));
plot(X2(:,1),v)