フィルターのクリア

how to find area under the curve with cumsum and cumtrapz?

17 ビュー (過去 30 日間)
Swati Umamaheshwaran
Swati Umamaheshwaran 2017 年 11 月 10 日
コメント済み: Swati Umamaheshwaran 2017 年 11 月 10 日
Please help. I am trying to find the area under the curve by using cumsum and cumtrapz but I am getting the wrong answer. I think there is an issue with the syntax of the input function and I am unable to figure it out.
  1 件のコメント
KL
KL 2017 年 11 月 10 日
Please post your code. Screenshots are nice but not as useful as formatted code.

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

採用された回答

John D'Errico
John D'Errico 2017 年 11 月 10 日
You should understand that a simple sum is not an integral. To approximate an integral using a Riemann sum, you also need to multiply by the interval. Thus, the area inside a rectangle is the product of the height and the width of the rectangle. If all you do is form the sum, you are just adding up the heights of those rectangles.
So I would predict, since the width of those rectangles is 0.01, that the cumsum would be off by a factor of roughly 100. I think that prediction comes pretty darn close.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by