MATLAB: How to calculate partial area-under-the-curve

plottrapz

Hi, I'm trying to find the area under the curve (ABC) for a part of a graph. I use the "trapz" function, but this function calculates the ABC for an entire area below the selected part of the graph. Any tips on how I can calculate only part of it (not the whole part up to the x axis)? Please see the figure. Interested are to be calculate is in red.
Thanks, Jacqueline

Best Answer

Use trapz twice, once to integrate (A, B, C), and again to integrate (A, C).
Then subtract the (A, C) result from the (A, B, C) result.
It would definitely help to have the data, preferably as a .mat file.