MATLAB Answers


Integrating velocity data with cumtrapz()

Asked by Fabian Gock on 19 Jun 2018
Latest activity Answered by Fabian Gock on 19 Jun 2018
I have a quite long vector with the longitudinal velocity data of a car. As it only drives forward, there are no negative values. However, when I integrate the vector using cumtrapz() the calculated data which are supposed to be the traveled distance, are also decreasing and even becoming negative.
Used Timestamps for cumtrapz are 0:0.01:59.53 The velocity vector is attached.
Thanks in advance! -Fabian

  1 Comment

2018 年 6 月 19 日
Seems to work fine for me:
x = 0:0.01:59.53;
Q = cumtrapz( x, chassis_velocity_longitudinal );
figure; plot( x, Q )

Sign in to comment.




1 Answer

回答者: Fabian Gock 2018 年 6 月 19 日

Oh god, I accidentally switched time and velocity.. Sorry for this embarrassing question and thanks for the quick help!
Kind regards -Fabian


Sign in to comment.