MATLAB: How to calculate the area which located between curve and x-axis

integrate energy consumptiontrapz

I would like to calculate only the area between the red curve and x-axis. That curve represents the power consumption. Is there a way to determine the total power consumed only in the selected area?
Thanks,

Best Answer

Try this:
X = [1427.18976 1427.21024 1427.23072 1427.2512 1427.27168 1427.29216 1427.31264 1427.33312 1427.3536 1427.37408 1427.39456 1427.41504 1427.43552 1427.456];
Y = [2098.083 2231.598 1888.275 1945.497 3280.65 6656.64 7667.55 7286.07 7514.94 7324.23 7095.33 6980.91 7534.02 7400.52];
Z = trapz(X, Y)