필터 지우기
필터 지우기

How can i integrate an array using the trapz function

조회 수: 8 (최근 30일)
Tariq Hammoudeh
Tariq Hammoudeh 2023년 3월 3일
댓글: Tariq Hammoudeh 2023년 3월 3일
If i have the following data
time=[1 2 3 4 5] %time in seconds
acceleration=[1.1 1.2 1.3 1.4 1.5]
Then how can I integrate acceleration and get the velocity at every second in the form of an array.
I tried v=trapz(acceleration);
but that just integrates acceleration and returns a single value

채택된 답변

Torsten
Torsten 2023년 3월 3일
이동: Torsten 2023년 3월 3일
Use cumtrapz instead.
  댓글 수: 3
Torsten
Torsten 2023년 3월 3일
편집: Torsten 2023년 3월 3일
Believe me: cumtrapz(time,acceleration) gives you the velocity field V with initial value V(time(1)) = 0.
If you do
(second element-first element)/time
you differentiate. But velocity is acceleration integrated.
Tariq Hammoudeh
Tariq Hammoudeh 2023년 3월 3일
oh I got it now thank you

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by