MATLAB: Integration within particular range

definite integralnumerical integration

Dear All,
I want to integrate the x, y. I use trapz(x,y). It gives me 1000. X-range id 0 to 4.45. But how to integrate with upper limit and lower limit i.e. 2 to 3. How to do it ? x is the first column and y is the 2nd column of the attached excel sheet.

Best Answer

idx = x>=2 && x<=3;
xp = x(idx);
yp = y(idx);
value = trapz(xp,yp)