Average value of power spectral density I have a spectra of power spectral density (PSD) (vector (1:1e6)) from experimental data (blue color).



However I want to plot only average value of PSD (red curve).

How can I do it by using MATLAB?

Thank you so much !
You should remove low frequency content of the diagram. Simply use moving average filter. find the optimum filter size that produces your desired result. Here is a matlab example code.
t=0:0.001:1;
PSD=2*sin(2*pi*1*t)+10*randn(size(t))+5; %assume as the power spectrum
filtered=zeros(size(t));
M=20 ;% Moving average filter size
for i=1:length(t)-M
    filtered(i)=mean(PSD(i:i+M));
end
plot(PSD);
hold on
plot(filtered,'r')