Borrar filtros
Borrar filtros

From Acceleration to Displacement Trapz Function

11 visualizaciones (últimos 30 días)
Ali
Ali el 23 de Mayo de 2014
Editada: Ali el 23 de Mayo de 2014
Hello,
I have the acceleration values as a vector and I need to integrate it to get velocity and displacement via Trapz function. trapz(acc) gives a value for V but how can i reach to the displacement value? Is there any way to integrate 2 times ? When i integrate V value it naturally gives me zero.
Thank you.

Respuestas (2)

Mahdi
Mahdi el 23 de Mayo de 2014
Consider using the cumtrapz function to find the displacement.
% Defined Acceleration values as Accel, Time is the steps of time
velocity=cumtrapz(Time, Acceleration)
Displacement=cumtrapz(Time, Velocity)
Or you can use the combination of cumtrapz and trapz to fit which solution you want.
  2 comentarios
Ali
Ali el 23 de Mayo de 2014
Thank you for answering !
I have my values tabulated but i dont have the exact function. They are just random values. First integration with trapz (V=trapz(time,acc)) gives me one single value as result. So it's a constant one value. When I integrate it for the second time (disp=trapz(V)) It results zero.
Mahdi
Mahdi el 23 de Mayo de 2014
Yeah, that's why I'm suggesting to use the cumtrapz function because it would give you velocities. Have a look at this link.

Iniciar sesión para comentar.


Ali
Ali el 23 de Mayo de 2014
Editada: Ali el 23 de Mayo de 2014
I did something hope it makes sense.
I have 485 values for each planes.(x,y,z) That one i wrote just for X values.
I seperated the values into 10 values group and got the trapz value for each interval of 10.
I ignored some of the values.(Like i have 485 but worked on 481 values)
Then I got 48 different Vx values.
Same process for the Ux(displacement) values.
This time each interval includes 5 values.
I hope its right.
for t=0:47;
accx=data((10*t+1):(10*t+11),1);
time=(t+1):(11+t);
Vx(t+1)=trapz(time,accx);
end
plot(Vx,'*');
for n=0:8;
Vxx=Vx(1,((5*n+1):(5*n+6)));
time2=(n+1):(6+n);
Ux(n+1)=trapz(time2,Vxx);
end
plot(Ux,'o');

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by