From Acceleration to Displacement Trapz Function

조회 수: 2 (최근 30일)
Ali
Ali 2014년 5월 23일
편집: Ali 2014년 5월 23일
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.

답변 (2개)

Mahdi
Mahdi 2014년 5월 23일
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
Ali
Ali 2014년 5월 23일
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 2014년 5월 23일
Yeah, that's why I'm suggesting to use the cumtrapz function because it would give you velocities. Have a look at this link.

댓글을 달려면 로그인하십시오.


Ali
Ali 2014년 5월 23일
편집: Ali 2014년 5월 23일
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');

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by