Calculate area under every point in a graph

1 回表示 (過去 30 日間)
Debbie Oomen
Debbie Oomen 2017 年 10 月 11 日
回答済み: Cam Salzberger 2017 年 10 月 11 日
I want to calculate the area under every point in EMG graphs. I have used the script: Int = trapz (x,y); however this calculates the entire area under the graph instead of the area under every point. What would be the script for this?
  1 件のコメント
KSSV
KSSV 2017 年 10 月 11 日
How you will get area under a point? To get area at least you need two points...

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

回答 (1 件)

Cam Salzberger
Cam Salzberger 2017 年 10 月 11 日
Hello Debbie,
I am assuming that you mean "area under a segment between two points" since, as KSSV says, you can't have an area under a single point. In this case, assuming you know that you want the area of the "ith" line segment (between the "ith" and the "(i+1)th" points), you can just do:
val = trapz(x(i:i+1), y(i:i+1));
If you simply want the height of a point, rather than the area, then it's just y(i).
-Cam

カテゴリ

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