Is there a function in Matlab that is similar to "cumtrapz" but uses a more accurate method of array integration (such as Simpson's rule)?

4 ビュー (過去 30 日間)
Is there a function in Matlab that is similar to "cumtrapz" but uses a more accurate method of array integration (such as Simpson's rule)? (i.e., to integrate a nonanalytic function (represented by an array))

採用された回答

John D'Errico
John D'Errico 2016 年 8 月 26 日
You COULD use a spline interpolant, then integrating the spline. That would be a higher order integration. (Pchip MAY be a better choice than spline, although spline will be theoretically a higher order as an integration tool here.)
Or you could use a Simpsons rule. Note that it is easy to think you are doing a better job, because the integration rule is of a "higher" polynomial order. In fact, it is trivial to give you a set of points that will cause a simple high order integration to fail miserably.
  2 件のコメント
Neil Gelman
Neil Gelman 2016 年 8 月 26 日
Thank you very much for your suggestion and explanation. I will try the spline.
John D'Errico
John D'Errico 2016 年 8 月 27 日
Note that integrating a spline function can be done analytically, since they are polynomial segments. (Again, pchip is also essentially a spline, but possibly a better choice for many problem.)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpline Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by