How to Numerically Integrate Vector with Timestep

13 ビュー (過去 30 日間)
pipesanddaggers
pipesanddaggers 2021 年 5 月 5 日
回答済み: Star Strider 2021 年 5 月 5 日
I have a vector / matrix I'm trying to numerically integrate and add to another vector, like so:
B= [1, 2, 3];
C = [8, 5, 4];
A = B + C(dt) <-- C being numerically intergrated with a timestep of 0.5. from 1 to 2000
I'm not sure what line or how to even go about writing this in my code, let alone plotting the data. Any help would be appreciated.

回答 (1 件)

Star Strider
Star Strider 2021 年 5 月 5 日
Use the trapz function (or cumtrapz, dependng on the result you want), The vector with respect to the numeric integration (time or whatever) is the first argument, and governs the integration steps.

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by