[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: On the use of windows
Let's be careful here.
I think the original request had to do with an FIR filter being implemented
via FFT using the overlap-add or overlap-save procedure. I agree that no
explicit window is needed in this case since the goal is just implementing
the linear time-invariant filter.
But it is a different story if the goal is to do spectral analysis or to do
analysis-modify-synthesis processing. What you need to DO with the spectral
data is the key here.
The discrete Fourier transform (DFT) is of finite length, hence, there is
ALWAYS a window--a rectangular window.
FFT algorithms compute the DFT. Hence, the statement and spectral analysis
example about "not using a window" actually means "use a rectangular window
AND ensure that the waveform being analyzed is perfectly periodic AND that
the period is exactly an integer divisor of the DFT length." Don't believe
it? Well, change the frequency to 5.25 in your equation 3, keeping N the
same, and see the spectral leakage in the FFT output.
Since in most signal analysis applications it is not possible to choose an
exact match between the waveform cycle and the DFT length, the data record
truncation effects will be unavoidable in the practical case.
The use of a smoothly tapered window is intended to reduce the spectral
sideband levels, BUT this is done at the expense of "smearing" the frequency
resolution. In other words, it is a tradeoff between resolving closely
spaced spectral components vs. avoiding spectral leakage (sidelobes). Going
for a narrow main lobe by using a rectangular window unavoidably dictates
One old but good reference:
fredric j. harris. On the use of windows for harmonic analysis with the
discrete Fourier transform. Proceedings of the IEEE, 66(1):51--82, January
From: AUDITORY Research in Auditory Perception
[mailto:AUDITORY@xxxxxxxxxxxxxxx] On Behalf Of Fred Herzfeld
Sent: Thursday, April 06, 2006 3:10 PM
Subject: On the use of windows
Once again the use of Windows to remove the edge effects reared its ugly
head and once again I must make it very clear that the use of any window
is very dangerous.
One window that exemplifies most windows is the raised cosine function
which can be written as:
W(j) = 0.5*(1-Cos(2*pi*(j-1)/N)) for j=0 to N-1 EQUATION (1)
where j is the bin number: N is the length of the FFT window in Bins
If W(j) is used by itself as the input to a FFT routine then of course
Bin number zero will have the DC value of W(j) = 0.5 and since W(j) just
exactly fits one cycle into the FFT the result in Bin number one will
have an amplitude of 0.5 and a phase of 180 degrees.
Next consider a single sinusoid as input to the FFT using a rectangular
window that is
W(j) = 1 for all j EQUATION (2)
where the input signal is:
S(j) = 1.0 Cos(2*pi*5*(j-1)/N -phi/180*pi) EQUATION (3)
where phi = 30 is the angle in degrees in this example.
The output of the FFT should then be all zeroes except for Bin 5 which
should have the amplitude 1.0 and the phase in degrees of 30.
So far so good. But now add (actually multiply) the raised cosine window
to the function in EQUATION (3). The output of the FFT will now be
(because of the window):
All bins will be zero except for
Bin 5 will now have A=0.5 and phi=30 . WOW! The function amplitude has
decreased by half. And the adjacent bins Bin 4 and Bin 6 no longer have
zero values ! Bin 4 and bin 5 will each have an amplitude of 0.5 and a
phase angle of 120 degrees. So first the amplitude has decreased by a
factor of 2 and the phase of these two components is now 120 degrees.
The "spectrum" hardly looks like the original single sinusoid. Why does
this happen with just the addition of the raised cosine window. The
answere is very simple. We are in effect modulating the single sinusoid
by the raised cosine. The fact that the raised cosine goes smoothly to
zero at each end does not really matter. All that does is generate a DC
component. The raised cosine is in effect a single sinusoid which falls
exactly into the first Bin thus forming the product of two sinusoids.
Think back about amplitude modulation. That IS what we have. We see the
results as the two upper and lower) sidebands of the original signal in
Bin 5. I call this the "Modulation Error" and as far as I know it has
not been dealt with in the literature. Therefore if the signal being
transformed by the use of the FFT is a sum of sinusoids, the
multiplication of this sum by ANY window will produce "Modulation
To further indicate how violent a window can act use the window given
in EQUATION (1) along with :
Bin 5: 1*Cos(2*pi*5*(J-1)/N - 30/180*pi) EQUATIONS
Bin 6: 2*Cos(2*pi*6*(J-1)/N - 30/180*pi)
Bin 7: 3*Cos(2*pi*7*(J-1)/N - 30/180*pi)
Bin 8: 4*Cos(2*pi*8*(J-1)/N - 30/180*pi)
Bin 3: -1*Cos(2*pi*35*(J-1)/N - 30/180*pi)
In Bin 5 I have the same function as in EQUATION (3) and the additional
4 sinusoidal terms are as show in EQUATION (4). Without any window we
then get zeroes in all Bins except:
Bin 3: amplitude = 1; phase = 210 degrees EQUATIONS (5)
Bin 5: amplitude = 1; phase = 30 degrees
Bin 6: amplitude = 2; phase = 30 degrees
Bin 7: amplitude = 3; phase = 30 degrees
Bin 8: amplitude = 4; phase = 30 degrees
Lastly if I now again add the raised cosine window I get:
Bin 2: amplitude = 0.25 phase = 30 degrees EQUATIONS (6)
Bin 3: amplitude = 0.50 phase = 210 degrees
Bin 8: amplitude = 1.25 phase = 30 degrees
Bin 8: amplitude = 1.00 phase = 210 degrees
Well, isn't that interesting. Without a window we have entries in 5
Bins which agrees with the input to the FFT. With a raised cosine window
there are entries in only 4 Bins and on top of that Bins 5,6,7 which
have outputs without a window are now zero when the raised cosine is
used. The other entries Bins 2,3,4,8,9 are also incorrect.
It is now to be realized that with "Modulation Error" caused by any
window each and every frequency component generates two sidebands which
will affect the immediately adjacent (upper and lower) components if
they exist and if they do not exist.
The exposition I have given above is the best reason I can give for not
using a window function with the FFT, the STFFT, the Fourier Series etc.
I will be very please to receive your responses and will answer each one.
Fred Herzfeld, MIT '54
78 Glynn Marsh Drive #59