Numerical Integration of Equally Spaced Data

1 回表示 (過去 30 日間)
David Koenig
David Koenig 2013 年 5 月 20 日
I have been using trapz to integrate a vector of equally spaced data. Is there a more accurate method available in script form that carries out the Simpson's method or perhaps the Newton-Cotes method? Thanks.

採用された回答

Youssef  Khmou
Youssef Khmou 2013 年 5 月 20 日
hi David,
I think using trapz integrator with the x/t axis gives good result, in the mean wile try to interpolate your data to get better accuracy , as this example :
t=0:1/100:pi/2;
y=sin(t);
f=trapz(t,y);
t2=interp(t,4);
y2=sin(t2);
f2=trapz(t2,y2) % Df=1.0064-0.9992=0.0072
  2 件のコメント
David Koenig
David Koenig 2013 年 5 月 20 日
Thanks, Youssef. I will give your idea a try.
Youssef  Khmou
Youssef Khmou 2013 年 5 月 20 日
編集済み: Youssef Khmou 2013 年 5 月 20 日
ok, do not accept the answer until it works to get other suggestions from other contributors

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by