How to calculate partial area-under-the-curve?

조회 수: 4 (최근 30일)
M G
M G 2014년 3월 22일
댓글: Laura Kim 2019년 5월 27일
Hi all,
I am trying to find the area under the curve (AUC) for a part of a graph. I use "trapz" function, but this function calculates the AUC for a entire area below the selected part of the graph. Any hint how I can calculate only part of it (not entire part until x-axis)? Please see figure. Interested are to be calculate is in red.
Thanks, Mehdi
(for simulation of data, just generate a random vector and try a part of it.)

채택된 답변

Mischa Kim
Mischa Kim 2014년 3월 22일
Mehdi, use trapz twice to subtract the area below the red marked one (between x-axis and data points y = 0.3111, 0.1848 ) from the entire area.
  댓글 수: 3
Mischa Kim
Mischa Kim 2014년 3월 22일
This should do
trapz(data(221:224)) - trapz([221 224],[data(221) data(224)])
Laura Kim
Laura Kim 2019년 5월 27일
Hi I was wondering if this method worked.
thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by