integration of numeric data - Matlab

69 Views Asked by At

I have multiple set of numeric data and I want to use Matlab to compute the integral. I used two methods:

-Using "trapz" function of Matlab.

-Using "spline" function and then using the "integral" function.

In general, the second approach is more accurate, BUT:

In some cases the results have significant error. And even increasing the number of datas does not reduce error anymore. (e.g., although using 100k points are more accurate than 10k points, using 1 million or 10 million points have same error as 100k points). The plot of the data is something like this

Is there any way to find the integral of a function like this accurately?

Thank you.