フィルターのクリア

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 Center および File ExchangeNumerical 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