필터 지우기
필터 지우기

Integration over elapsed time

조회 수: 2 (최근 30일)
Aswas
Aswas 2015년 10월 12일
댓글: Aswas 2015년 10월 12일
I have elapsed time and want to find velocity:(ie time would then be :[0 1 2 3 4 5 6]), any way to do this please, as following code only works when time is specified in increments:
etime = [0 1 1 1 1 1 1]; % elapsed time in sec
a = [0,2,4,7,11,17,24]; %acceleration in m/s^2
v(1)=0;
for k=1:6
v(k+1) = trapz(etime(k:k+1), a(k:k+1))+ v(k);
end
disp([v'])

채택된 답변

Walter Roberson
Walter Roberson 2015년 10월 12일
t = cumsum(etime);
v = cumtrapz(t, a);
  댓글 수: 1
Aswas
Aswas 2015년 10월 12일
Thanks Walter.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by