Faster method of numerical Integration?

7 ビュー (過去 30 日間)
Jay
Jay 2012 年 4 月 17 日
Howdy,
I'm currently running a for loop containing only the trapezoidal rule and a count variable, i.e. something like:
for n=2:length(a)
computeVel(n-1,1) = trapz(a,b);
n=n+1;
end
I'm running this for 600k iterations, and will be running it often. I need the solution at each successive upper bound in the vector 'b.' I.e., if b=[1,2,3,4] i need the integral on 1 to 2, 1 to 3, and 1 to 4.
Is there a fast(er) way to do this?

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 4 月 17 日
out = cumtrapz(a,b)
  1 件のコメント
Jay
Jay 2012 年 4 月 17 日
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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