double integration of acceleration data with offset

조회 수: 3 (최근 30일)
Mat CR
Mat CR 2019년 11월 19일
댓글: Rena Berman 2019년 12월 12일
hello there
i want to use the accerleration with offset added to it and then double intgrate using cumtrapz to obtain velocity and position, but when i plot my offset position it doesnt look anywhere near my real position even tho it has only 0.1 offset from integrating acceleration.
here is the code i used
a=0.5 % amplitude
f=5 % frequency
t=linspace(0,10,500);
v0 = a*(2*pi/f)*cos(2*pi/f*t(1)); % initial velocity
p0 = a*sin((2*pi)/f*t(1)); % initial position
acc= -4*a.*pi^2./f.^2 .* sin(2*pi./f .* t); % accleration data
off_set=0.1;
acc=acc+off_set;
figure (1)
plot(t,acc,'g','linewidth',2);
xlabel('Time (s)')
ylabel('amplitude')
title('accleration')
vel=cumtrapz(t,acc)+v0; % integrated velocity
pos=cumtrapz(t,vel)+p0 % intgrated positon
figure(2)
plot(t,pos,'r-') % plot the position
xlabel('Time (s)')
ylabel('amplitude')
title('offset position')
% what my real position look like real position
pos=a*sin((2*pi)/f*t) % intial position
plot(t,pos,'b-'); % plot for position
title(' real positon')
ylabel('amplitude')
xlabel('time(s)')
i want to be able to add offset to acceleration, and when i double intgrate to get a position with offset, somewhat obtain a plot similar to my real position even tho it has 0.1 offset.
any help would be massivley appreaciated

채택된 답변

James Tursa
James Tursa 2019년 11월 19일
편집: James Tursa 2019년 11월 19일
You put a constant offset into the acceleration, not the position. The result of double integrating a constant is going to be a (1/2)(constant offset)*t.^2 offset in position. I.e., growing position difference with time, not a constant offset position.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by