Info

This question is closed. Reopen it to edit or answer.

how to calculate and plot time evolving PSD

3 views (last 30 days)
I need to calculate time-evolving power spectral density using Matlab periodogram function based on Welch theory to estimate the PSD of a moving boxcar filter with an overlap of 85%. In all the figures, values have to be plotted at the center of each window over which they are calculated. I got the answer: "If you want to use Welch's method in a time-evolving manner, use buffer() to segment the signal with overlap and obtain Welch estimates on those overlapped segments. I would caution you against using a boxcar filter, here I'll give you an example with a Hamming window. You can substitute your boxcar filter as needed. Further, you have not been clear about whether the overlap of 85% applies to both the time-evolving PSD or the overlap in the Welch's estimate, I'll use 50% for the latter. Fs = 1000; t = 0:0.001:4-0.001; x = cos(2*pi*10*t)+randn(size(t)); winsize = 200; numoverlap = round(0.85*winsize); win = hamming(200); %boxcar filter insted X = buffer(x,200,numoverlap); for nn = 1:size(X,2) [Pxx(:,nn),F] = pwelch(X(:,nn),win,length(win)/2,length(win),Fs); end"
I tried to apply what was suggested, I am still not sure if I got the results I need as I don’t know how to plot the results. The values have to be plotted at the center of each window over which they are calculated. Could you please explain how to do this? Thank you very much.

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!