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 !
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.Sign up to join this community
You should remove how 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')