0
$\begingroup$

I've been reading about power spectral density estimation based on the DFT, about spectral leakage, windowing functions and the Welch method. I've recorded a signal that's supposed to be pretty much pink noise, but of course, there's always something superimposed, am I'm struck by the effect it has on the result of the estimation. enter image description here

The blue line shows the estimation using a rectangular window of size N with no overlap, whereas the orange line uses a Hann window with 2/3 overlap (this is supposed to give best amplitude and power flatness). N=10000 is such that I get a bin size of 1mHz and around 200 adjacent windows in the case of the boxcar window.

So I understand that there's two effects that need to be traded off when choosing a windowing function: The -3db frequency (or width of the main lobe) and the decay of the side lobe amplitude. I looked at the response of both windows.

With this knowledge I however still fail to understand whether the hann window underestimates the overall power compared to the boxcar window or if the side lobes of the boxcar window raise the overall level compared to the Hann window curve. I also don't know if the side ripples seen in the Hann window curve are "real" or just leakage from the noise upwards of 3Hz and whether this is an effect of the main lobe width or from the side lobes.

$\endgroup$
2
  • $\begingroup$ If you want to see if something is actually pink, it's best to plot it on a log-log scale. Pink is then a straight line with a -10dB/decade slope. Its also good practice to label your axis with actual units. $\endgroup$
    – Hilmar
    Mar 2, 2022 at 9:59
  • $\begingroup$ @Hilmar I decided in this case for the linear frequency scale as to not skew the (perceived) symmetry of the lobes in the orange curve. Units are usually good practice, I agree, but in some cases (I'd argue this is one), "Hz" or "rad" is irrelevant and just distracts from the shape. $\endgroup$
    – Xaser
    Mar 2, 2022 at 10:03

1 Answer 1

1
$\begingroup$

The blue curve is the sidelobes of the rectangular window. If the actual window duration for the Hann window case was significantly shorter than that used for the rectangular window, then the orange curve may partially be sidelobes of the hann window itself, or actual power from the signal windowed or likely a mix of the two (in particular where the orange curve begins to increase again). To know for sure which is window sidelobes versus signal review the Kernel of the window itself for the given configuration (window length). The Kernel is the Discrete-Time Fourier Transform (DTFT) of the window and shows the expected frequency response which would convolve with all actual signals present. The DTFT (not the FFT!) can be estimated by zero-padding the FFT, which will interpolate more samples between the FFT bins to indicate the continuous DTFT response.

As an example, I show this below for the case of a 256 length window comparing the Boxcar window with the Hann window. Further processing with the Welsh method would reduce the variability due to averaging together with the noise, but the relative sidelobe levels would be as indicated in this plot. Notice the significantly lower sidelobe level for the Hann vs Boxcar when the windows are the same length. If for the OP's case it was known that the windows used were the same length, then we can more confidently state that the orange trace is due to the signal itself and not a sidelobe of the window.

Hann

$\endgroup$
4
  • $\begingroup$ Windows size was indeed the same: 10k samples. Since you said that the welch method would reduce the effect of the side lobes, I'm actually surprised that there is still such a big difference between hann and boxcar windows, since 200 averages should severely suppress the side lobes even for the boxcar (not relatively but absolutely in my plot). $\endgroup$
    – Xaser
    Mar 2, 2022 at 9:53
  • $\begingroup$ @Xaser Is your plot of the windowed noise? $\endgroup$ Mar 2, 2022 at 11:47
  • $\begingroup$ I realize my original phrasing was perhaps unclear, I tried to improve it. I do not fully understand your question though. Trying to clarify: My plots show the PSD estimations using the welch method (scipy.signal.welch) with the specified windows, window sizes and overlap. The TD signal is noise. $\endgroup$
    – Xaser
    Mar 2, 2022 at 12:56
  • 1
    $\begingroup$ In that case since we have confirmed that the Hann window sidelobes are significantly lower we are seeing the signal components themselves for the case of the Hann. The signal convolves with the window so in the boxcar case the sidelobes from the stronger lower frequency components are higher than the lower level signal components so we see the sidelobes in that case $\endgroup$ Mar 2, 2022 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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