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.
(for simulation of data, just generate a random vector and try a part of it.)