Trapezoidal rule with unevenly spaced data points

26 ビュー (過去 30 日間)
Georgia Platt
Georgia Platt 2022 年 9 月 22 日
コメント済み: Walter Roberson 2022 年 9 月 22 日
I am having a lot of trouble using the trapezoidal method on matlab to determine the area under the curve with no function, just unevenly spaced data points:
(0,0), (1,5), (5,8), (9,6), (3,10), (0,11)
I have absolutely no idea where to start.
  6 件のコメント
Walter Roberson
Walter Roberson 2022 年 9 月 22 日
You can decompose into shapes. There is an initial triangle, and you can get the area for that as 1/2 base times height. There are then a series of trapazoids, and you can calculate their areas. Then there is a final triangle and 1/2 base times height for it. Add the areas all together.
... which is what trapz() will do for you.


回答 (1 件)

Matt J
Matt J 2022 年 9 月 22 日
See trapz.




Community Treasure Hunt

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

Start Hunting!

Translated by