Effacer les filtres
Effacer les filtres

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

4 vues (au cours des 30 derniers jours)
M G
M G le 22 Mar 2014
Commenté : Laura Kim le 27 Mai 2019
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.)

Réponse acceptée

Mischa Kim
Mischa Kim le 22 Mar 2014
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 commentaires
Mischa Kim
Mischa Kim le 22 Mar 2014
This should do
trapz(data(221:224)) - trapz([221 224],[data(221) data(224)])
Laura Kim
Laura Kim le 27 Mai 2019
Hi I was wondering if this method worked.
thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by