pwelch windowing hanning vs. rectangular, different windows change output completely..

33 views (last 30 days)
I am running into something I have not yet managed to figure out after quite some googling.
I try to compute the PSD (power spectral density) of fluctuating system noise that is random for 160 measurements. The noise is located in 160 matrices of 16000x197, in which each column is a signal. The signals are all of equal length and have equal sampling frequency.
I take the PSD and FFT of each column and the median of this, as can be seen in the code, so I am left with a 160 PSD's and FFT's to estimate the flucuating system noise levels across the160 measurements. The code I use for each matrix/measurement is given below. The noise fluctuates across the 160 measurements which can be clearly seen in FFT estimates.
But for the PSD it is dependent on the windowing and overlap of windowing if these fluctuations are still visible. I need the PSD as this value is the most useful for describing the noise for other people that might have performed different measurements (different lenght or sampling freq.).
When I use (shown in image):
[PSD_data(:,ii),PSD_xax]= pwelch(data(:,ii),hann(500),250,[1:250],500);
the fluctuations are absent, as can be seen in the top image.
But when I use:
[PSD_data(:,ii),PSD_xax]= pwelch(data(:,ii),rectwin(500),250,[1:250],500);
they are clearly visible and the spectrum looks more like the FFT but with a lot less variance. (bottom image).
I dont exactly understand why different windowing (rectangular or hanning) would take out the fluctuations completely. I hope someone could possibly explain this to me? I would be really grateful!
[row,col] = size(data); % Data = 16000x197
FFT_data = zeros((row-1)/2,col);
PSD_data = zeros(250,col);
for ii =1:col
[FFT_xax,FFT_data(:,ii)] = myfft(data(:,ii),fs);
[PSD_data(:,ii),PSD_xax]= pwelch(data(:,ii),hann(500),250,[1:250],500);
end
med_FFT = median(abs(FFT_data),2);
med_PSD = median(PSD_data,2);
end
  1 Comment
Mathieu NOE
Mathieu NOE on 13 Oct 2020
hello
the selection of a type of window is a compromise
I don't think that a rectangular window is appropriate for the type of signals you are dealing with (continuous noise).
It should be used only when you are sure tha the signal starts and ends with zero amplitude in the buffer size
I would stick to hanning & hamming & alike (windows must be zero amplitude at start and end)

Sign in to comment.

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!