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

enter image description here

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

How can I do it by using MATLAB?

Thank you so much !

  • $\begingroup$ Just my usual ranting: the PSD is a stochastic expectation value. What you have, based on an experiment, is an estimate of the PSD. $\endgroup$ Mar 23 '17 at 8:13

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.

PSD=2*sin(2*pi*1*t)+10*randn(size(t))+5; %assume as the power spectrum
M=20 ;% Moving average filter size
for i=1:length(t)-M
hold on

enter image description here

  • $\begingroup$ Actually, I need to plot the frequency dispersion of frequency noise from laser. That why I have to use the frequency in this graph. $\endgroup$ Mar 23 '17 at 7:18
  • $\begingroup$ Actually, by frequency, I do not mean the frequency of actual data (which in your case is noise from laser). I meant to consider the PSD plot itself as a signal. $\endgroup$
    – MimSaad
    Mar 23 '17 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.