# importance of symmetric windows for STFT for practical applications

I am wondering why is the linear phase property of filters with symmetric coefficients important for some practical applications of short time fourier transform, such as image processing? I have read that the linear phase property will ensure that there will be no phase distortion of the signal by the filter? Can anyone explain the reason?

• Aside: Odd. Why would anyone bother with STFTs for images? There's very little use (except for pretty pictures) for 1D signals, let alone 2D. PS: That's a better question! – Peter K. Nov 21 '13 at 12:40
• @PeterK.: Anyway does the linear phase property of symmetric windows help? – meta_warrior Nov 21 '13 at 12:43

This example may help you to understand this.

The plot below shows the step response for two filters that have the same magnitude response, but the first has non constant group delay (non linear phase) while the second has constant group delay (linear phase).

The first filter is a minimum phase version of the second filter.

• Hi, how about for generalised linear phase, where the phase is of the form $a\omega+b$? Will there be phase distortion of signal? – meta_warrior Feb 13 '14 at 0:07

You've already explained the reason. A filter with linear phase, or a constant group delay, will delay all frequencies equally in time. The easiest example is using a filter with a group delay that is not linear on an audio track. You'll find that high or low frequencies will be advanced or delayed independent of each other resulting in a somewhat funny sounding result.

For images this would manifest itself, although not as pronounced, as periodic components being shifted around, so you would see some sort of blurring.

• This is what I have read, but I don't understand. Can you show an example? – meta_warrior Nov 21 '13 at 13:59
• Hi, how about for generalised linear phase, where the phase is of the form $a\omega+b$? Will there be phase distortion of signal? – meta_warrior Feb 13 '14 at 0:14
• Yes, the delay, or group delay, is the negative the derivative of the phase, so it would be "a" in your case. wiki – porten Feb 13 '14 at 5:01

Application of a window in the time domain means that the spectrum is convolved with the Fourier transform of the window.

Let's look at applying three different windows to a simple sine wave: a Hann window, a Hann window modulated randomly, and a Hann window that is made anti-symmetric.

The magnitude of the FFT of each window:

As you can see, the only option that gives any benefit is the Hann window: it reduces spectral leakage (though at the cost of broadening the peak slightly).

The other two windows just much up the spectrum to no real benefit.

Source code in scilab:

WN = 100;
SN =  100;
omega = 2*%pi*9.887423;
t = [0:SN-1]/SN;
phi = rand(1,1)*2*%pi;

X = sin(omega*t+phi);
W = window('hn',WN);
W2 = W.*rand(1,WN);
W3 = W.*(bool2s((t-0.5) > 0) - 0.5)*2;

function plot_it(X,W,fig)
figure(fig)
clf
subplot(221)
plot(X);
title('Signal')

subplot(222)
plot(W);
title('Window')

subplot(223);
plot(abs(fft(X)))
title('FFT of signal without window')

subplot(224);
plot(abs(fft(X.*W)))
title('FFT of signal WITH window')
endfunction

plot_it(X,W,1)
plot_it(X,W2,2)
plot_it(X,W3,3)

figure(4)
clf
subplot(311);
plot(fftshift(abs(fft(W))))
subplot(312);
plot(fftshift(abs(fft(W2))))
subplot(313);
plot(fftshift(abs(fft(W3))))