I was thinking about the DFT windowing subject and a thought came to my mind. A DFT will yield the spectrum of a signal convoluted with spectrum of the window used, therefore having a main lobes and side lobes.

I figured it would be possible to remove the window effect on the spectrum of the signal by convoluting again both the signal and the window spectrum magnitude, and it did indeed works as you can see on the following image.

enter image description here

Left is the original spectrum generated with a hanning window. Right is the spectrum convoluted by the DFT of a hanning window. Top is the Spectrum itself, bottom is MATLAB findpeaks result.

I never read anything regarding this technique, but I am pretty sure I haven't invented anything there. So I am wondering if there is a benefit of doing this processing on the spectrum or if there is a downside to it that I am not seeing.

From what I see, this could help peak detection as we can see on the previous image. Also, it looks like the spectrum is a little bit distorted as we can see on the 2 following images. :

enter image description here enter image description here

Where the blue graph is the spectrum and the red graph the post-convoluted spectrum.

  • Any thought about this?
  • Is there a problem that could arise from this post-FFT convolution?
  • Any paper that treats the subject?


You can find a script here that will generate the following graph:

enter image description here

  • 1
    $\begingroup$ Could you provide the code which you used to plot the figures? I assume that the smoothness of the convolved function is just an issue of resolution. You can't undo the windowing by convolving yet one more time with the same window (you would indeed need to deconvolve, which is what rbj's answer refers to). Furthermore, a real improvement would be an increased frequency resolution, and/or an increased sidelobe suppression, none of which is achieved here. Finding the "correct" peaks is relatively easy for both functions. $\endgroup$ – Matt L. Dec 31 '16 at 10:47
  • $\begingroup$ I just edited my post to add an example of code. $\endgroup$ – Pier-Yves Lessard Dec 31 '16 at 15:05

There is, in fact, a downside to your suggestion: the signals you showed are all very clearly divided into their frequency components, but in general, real-life signals tend to be more noisy.

Depending on the application, you'd want as much leakage dampening (higher main lobes/smaller side lobes of a signal frequency in the transformed spectrum) or, as another example, the narrowest possible main lobe.

In your plots, it is visible that smoothing the magnitude spectra with a window does the opposite of these: the main lobes get wider and smaller, while leakage products from transforming a finite time signal gain in power. Applied to noisy signals, this would yield a significant disadvantage.

Your suggestion, however, is still pretty useful for peak identification!


it's a good question and a good insight that i'm pretty sure others have had. the de-convolution in the frequency domain is like multiplying in the time domain and if you're deconvolving the effect of a Hann window in the frequency domain, it's like your dividing by the effect of the Hann window in the time domain. at the tails where the Hann window goes to zero, there's dividing by too small of a number to worry about.

usually the window effect is left in because if you're transforming back you might want the window's effect in the time domain. or if you're never transforming back (this is an analysis or modeling alg and not a modification alg) then you're only interested in parameters that are properties of those peaks, and you just deal with the known effect of convolving with a known kernel and that might modify an extracted parameter in a deterministic manner. then you just compensate for that in your extracted parameter.

lastly, depending on what you're doing, you might want to consider using a guassian window for analysis. has very little sidelobe problem and under linear conditions (like a filter), each windowed sinusoid retains the windowed shape when transformed back to the time domain. that window can be undone and a Hann window applied after transforming back to the time domain.

  • 6
    $\begingroup$ In principle I agree to your statements. Though, the OP is not talking about deconvolution, but convolving the obtained spectrum with the spectrum of the hanning window. (i.e. essentially windowing with a hanning-squared window) $\endgroup$ – Maximilian Matthé Dec 31 '16 at 10:05
  • 1
    $\begingroup$ no, the OP is talking about removing the effect, not doubling the effect. division is the same as multiplication by the reciprocal. it is multiplying by such a number that gives you the result we call the quotient. being that convolving in one domain is the same as multiplying in the other domain, then deconvolution is the same as convolving with something specially determined. $\endgroup$ – robert bristow-johnson Dec 31 '16 at 18:07
  • 2
    $\begingroup$ The OP is talking about removing the ripples, by performing a convolution of the obtained spectrum with the spectrum of the window. This yields multiplication of the signal with the squared window (one window from the initial multiplication in time, the second one coming from the convolution in frequency) $\endgroup$ – Maximilian Matthé Dec 31 '16 at 20:02
  • $\begingroup$ Well, not exactly. I do a convolution of the magnitudes of the spectrum which yield a different results from the multiplication of the squared window. I am not sure what it represents mathematically... I see it as a cross correlation between both spectrum magnitudes (since windows spectrums are symmetrical). $\endgroup$ – Pier-Yves Lessard Nov 4 '17 at 3:15

The technique you used of smoothing the spectrum is often used when analyzing the spectrum itself and you don't care about the effects in the time domain (e.g. doing frequency based signal detection or bandwidth measurement). There's not even a requirement that the window used for smoothing be the same as the window used in the time domain. One of the main reasons to use a time-domain window before the DFT is to minimize the discontinuity in the wrap-around that the DFT assumes at the ends of the signal (the DFT is inherently circular). The purpose of smoothing in the frequency domain is to facilitate analysis such as peak detection or bandwidth measurement. The "best" window for one may not be the "best" window for the other. In fact, I have never seen the DFT of a window used for spectral smoothing. I have seen reasonable results by using a simple boxcar (rect) window to smooth the spectrum.

  • $\begingroup$ The way I understand it, is that I am doing a cross correlation with the spectrum, threfore getting peaks in the center of the main lobes. Using the time domain windows seems like the obvious choices and I don't see why I would use a boxcar window cross correlation to find where the hanning window spectrum is located. Why would we want something else than the same window ? $\endgroup$ – Pier-Yves Lessard Mar 29 '17 at 0:57
  • $\begingroup$ Yes, the result you describe is a convolution with the autocorrelation of the window, but that is just convolving with a different window. The autocorrelation will result in a VERY tight peak at DC. So you effectively convolved the signal spectrum with a very tight low pass filter. It is the frequency response of this filter that is giving you the result you see, not the fact that it is an autocorrelation. The fact that it is an autocorrelation is coincidence. $\endgroup$ – cassman Mar 29 '17 at 12:53

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.