Integrating velocity data with cumtrapz()

16 visualizaciones (últimos 30 días)
Fabian Gock
Fabian Gock el 19 de Jun. de 2018
Respondida: Fabian Gock el 19 de Jun. de 2018
Hi,
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 comentario
Adam
Adam el 19 de Jun. de 2018
Editada: Adam el 19 de Jun. de 2018
Seems to work fine for me:
x = 0:0.01:59.53;
Q = cumtrapz( x, chassis_velocity_longitudinal );
figure; plot( x, Q )

Iniciar sesión para comentar.

Respuestas (1)

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

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by