Integration of displacement to velocity then acceleration

I want to integrate this displacement vector (jh) to get velocity and then to get acceleration.
There are multiple trials of which I need to integrate from. when i do:
%%Calculation of Velocity and Acceleration
v= trapz (jh);
a= trapz (v);
this gives an output for the V but not for the A. When I do cumtrapz below:
%%Calculation of Velocity and Acceleration
v= cumtrapz (jh);
a= cumtrapz (v);
This is a cumulative integration and this is not what I want

 Respuesta aceptada

Don't you mean take the derivative of displacement with respect to time to get velocity and again for acceleration?
doc diff

4 comentarios

yes i think so, how do i use that? i just try to search it in the help and it didn't come up?
A simple example:
dt = 0.01;
x = 0:dt:(2*pi);
mydisplacement = sin(x);
vel = diff(mydisplacement)./dt;
acc = diff(vel)./dt;
h = plot(x,mydisplacement,x(1:end-1),vel,x(1:end-2),acc);
legend('displacement','velocity','acceleration')
Adrienne
Adrienne el 15 de Mayo de 2014
Editada: Adrienne el 15 de Mayo de 2014
i still don't know what i've done wrong:
dt=tof*[1:1:jh];
x= (data(:,5));
y= (data(:,5));
vx= diff(jh)./dt;
I would guess you would want dt to be a column vector so it's the same shape and size as x and y and you will want to have it be the change in time, not absolute time.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 15 de Mayo de 2014

Comentada:

el 16 de Mayo de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by