Window functions

A project log for Open Source FFT Spectrum Analyzer

An FFT spectrum analyzer for machinery vibration analysis, using open source hardware and software

Ariel Quezada 06/09/2016 at 15:150 Comments

Window functions are used to avoid signal leakage, that can hide low amplitude level signals when their frequency is close to high amplitude level ones. To avoid this leakage, the input samples are multiplied to a mathematical function, so the samples at the center of the sampled time are favored while the values of the samples at the extremes, are lowered. Usually Hann and Flattop windows are applied. Using Python and Scipy, applying window functions is very simple.

First, you have to import the signal module

from scipy import signal

Then create the window function coefficients. For the Hann window use

w = signal.hann(N, sym=False)

For the Flattop window use

w = signal.flattop(N, sym=False)

N is the length of the signal (number of samples).

Finally apply the FFT to the signal weighted with the window function.

yf = fftpack.fft(y*w)

Program plots the FFT spectrum using the window functions.

After applying the window functions, no much change is visible in the signal frequency separation and only the amplitude is reduced. Apparently, signal leakage is low for the sampled data used, and further testing would be required to validate this functions.