I am processing sensor signals and have been looking at using window functions to smooth out the signal before I conduct a fft on it. A normal symmetrical hanning function seems to disorientate the signal a little bit as my signal isnt symmetric. I wanted to ask if there is a way to have a non symmetric hanning function which is lopsided towards the initial part of the signal.

example of what I mean is,

normal hann for t 0 to 1, peak at 0.5.

id like for t 0 to 1, peak at 0.2.

I am using python so if there is any suggestions regarding python functions or code I would appreciate it greatly

  • $\begingroup$ Windowing a sequence and "smoothing" a sequence are two different operations. What exactly do you mean when you say, "smooth out the signal before I conduct a fft on it"? $\endgroup$ Dec 8, 2021 at 9:15
  • $\begingroup$ I just want to use a windowing function such that the my non periodic signal doesnt have a big jump at the ends. Hanning window functions seems like the most common one to use however as stated above my signal is also nonsymmetric. Hope that explains it a bit better $\endgroup$ Dec 8, 2021 at 9:41

2 Answers 2


What about generating two windows (eg Hann) for two lengrhs, L1 and L2. Then assemble one window from the first half of one and the second half of the other?

Edit: Something like ala (MATLAB-ese)

N = [12 240];
win1 = hamming(N(1));
win2 = hamming(N(2));
win = [win1(1:end/2) win2((end/2+1):1)];
  • $\begingroup$ Im assuming this would be done manually? rather than a python function that would do this for me. If you could attach a sample code of how to attach it would be super useful. Currently i just use numpy.hanning(x) $\endgroup$ Dec 8, 2021 at 9:42

@Jazim Schail. Do you really want to window your signal? Is your goal to use a window sequence to reduce FFT spectral leakage?

Because window sequences are so heavily discussed in the tutorial literature of spectrum analysis I'm afraid many DSP beginners fall into the trap of thinking all signal sequences should be windowed before they are applied to an FFT. This is not true.

Windowing should only be used when your goal is to monitor (measure) a low-magnitude "spectral component of interest" that is located nearby-in-frequency to a high-magnitude spectral component in which you are not interested. In that case, the high spectral sidelobe components of the high-magnitude signal are covering up (masking, obscuring) the nearby low-magnitude signal's spectral components that you want to monitor. In this case windowing is appropriate to reduce the sidelobe levels of the high-magnitude unwanted signal.

Jazim, does the above scenario describe your spectrum analysis activity? If so then just use a "periodic" Hann (Hanning) window, not the "symmetrical" Hann window. If spectral leakage reduction is NOT your goal, then do not window your sensor signals.

In any case, I suggest you do not window the sensor signal with an asymmetrical window sequence. I believe doing so would result in a "smeared" (distorted) spectrum which would be difficult to interpret correctly.


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.