MATLAB: Estimate area under a complex curve

area under curve

I would like to calculate the area under a complex curve whose function is not known.
The graph shows the power spectral density versus frequency.
As part of the design, I need to estimate the total energy which is the integral of the psd vs frequency curve.
I have used trapz (x,y) function to estimate the area under the curve but it seems it is not accurate.
Is there a better way to estimate the area in the matlab?

Best Answer

The trapz function is likely the best option. The ‘accuracy’ may reflect the way you called it. (Without the data and your code, we will never know.) The image shows the power spectral density from about 1490 (Hz?) to about 4000 (Hz?), so it would be necessary to determine the indices of that part of the spectrum and integrate only that part of it.
Related Question