MATLAB: Area of a Spectrum

areasrs

What matlab command can give me the area of a spectrum. I have shock response spectrum but i need to find the area under the curve.

Best Answer

The area under your curve should just be:
N = numel(x);
dt = 1/fs;
df = fs/N;
y = fft(x)*dt;
area_y = sum(abs(y))*df; % which is also equal to: sum(abs(fft(x)))/N
energy_y = sum(abs(y).^2)*df;
If you really want "energy", then energy_y should be equal to energy_x:
energy_x = sum(x.^2)*dt;