FFT-System Overview:

advertisement
FHNW
RATHER FILTERBANK THAN FFT
Prof. Bruno Stuber (bruno.stuber@fhnw.ch) , Institut für Automation
Fachhochschule Nordwestschweiz, Brugg-Windisch (Schweiz)
Summary:
This document explains the difference between a "standard" DFT/ FFT spectral analysis and a
filterbank. It is shown that the filterbank highly improves the separation between adjacent frequency
channels (bins), hence the spectrum is much better resolved, there is less overlap between adjacent bins
and the sidelobe suppression is improved.
The filterbank is implemented by an extension of the standard DFT/ FFT, a polyphase pre-filter stage.
It is also shown that most of the commonly used windows for the DFT/ FFT, such as Hanning, Kaiser
etc., are not appropriate for the filterbank.
1) Comparison "standard" DFT versus Filterbank
The DFT/ FFT:
The most common approach to examine the spectrum of a signal is the Discrete Fourier Transform
(DFT) which is implemented in an efficient way as Fast Fourier Transform (FFT). The principle of the
DFT/ FFT (hereafter the term DFT is used) is explained in Fig. 1 below:
Signal Frame: N Samples
Window
t
TF
DFT-/ FFT-Spectrum:
(Signal x Window)
Scalar Product
with:
DC
Bin: 0 1
2
3 …
1 Period
… n
f
… (N-1)
∆f = 1/TF
2 Periods
t
n Periods
Fig. 1 DFT/ FFT principle
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
1
FHNW
The spectrum is computed at discrete frequencies, there are exact N spectral values (or lines) which are
also called the bins, ranging from bin 0 to bin (N-1). Every bin is separated on the frequency scale by
∆f = 1/TF, TF the length of the signal frame.
A specific bin n is computed performing the scalar product between the windowed signal with the n
periods of a harmonic, the orthogonal base functions, n = 0, 1, 2, … The harmonic is expressed in
complex notation as 𝑒𝑒
−𝑗𝑗 𝑛𝑛
2𝜋𝜋
𝑇𝑇𝐹𝐹
𝑡𝑡
, thus addressing the cosine and sinus as real and imaginary part.
If the windowed signal is also a harmonic with an integer number of periods, the spectrum responds
exactly at the corresponding bin. If the harmonics envelope is shaped by the window, the response is
widened also to neighbor bins.
With a fractional number of periods the spectrum responds in principle at all neighbor bins with
descending amplitude, the effect is called the leakage effect. To reduce the leakage effect a window
function other than a rectangular window is necessary.
The response of a bin in function of the signal frequency follows a specific bandpass filter shape, the
selectivity curve of that bin. This follows from the Fourier correspondence below, expressed in the
analogue domain:
(Assuming the window centered and symmetric: w(-t) = w(t); "< ; >" denotes scalar product, "*" convolution).
𝑭𝑭𝑭𝑭
< 𝑠𝑠(𝑡𝑡) ∙ 𝑤𝑤(𝑡𝑡); 𝑒𝑒 −𝑗𝑗 𝑛𝑛 𝜔𝜔0 𝑡𝑡 > = 𝑠𝑠(𝑡𝑡) ∗ �𝑤𝑤 (𝑡𝑡) ∙ 𝑒𝑒 𝑗𝑗 𝑛𝑛 𝜔𝜔0 𝑡𝑡 � ⇔ 𝑆𝑆(𝜔𝜔) ∙ 𝑊𝑊(𝜔𝜔 − 𝜔𝜔0 )
From this point of view the DFT acts as a bank of adjacent bandpass filters. The window
function determines the lowpass filter characteristic for bin 0, the other filters are shifted and
centered at the frequency position of the n-th bin. A bin thus "collects" the signals spectrum
around its center frequency.
The DFT suffers from the fact that a narrow window leads to a broad filter shape with significant
overlap, the effect is shown in Fig. 2 below for different common window functions. The overall filter
shape is mainly dictated by the restricted window length in the time domain.
Selectivity DFT/ FFT | Different Window s
1
Kaiser 9
Hanning
0.8
Blackman
0.6
0.4
0.2
0
-5
-4
-3
-2
-1
0
Bin
1
2
3
4
5
Fig. 2 Overlap of selectivity curves for different DFT/ FFT windows
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
2
FHNW
The Filterbank:
To obtain a filter shape which tends more towards the ideal rectangular filter shape with bandwidth ∆f,
the window function in the time domain has to be broadened. The effect is demonstrated in Fig. 3.
The extent of the filterbank window is in this case four times the width of the DFT window, denoted by
the factor L = 4. This results in less overlap and a fast decay of the bandpass filter shape.
FFT Window: Kaiser 9
Selectivity DFT/ FFT
1
1
0.8
0.6
0.5
0.4
0.2
0
-2
-0.5
0 0.5
2
0
-3
-2
-1
Filterbank Window: Def FT_1
-0.5
0
0.5
1
2
3
1
2
3
Selectivity Filterbank
1
1
0.8
0.6
0.5
0.4
0.2
0
-2
-1
0
Frames
1
2
0
-3
-2
-1
-0.5
0
Bin
0.5
Fig. 3 Comparison window functions and selectivity curves for DFT/ DFT (top)
and (L=4) filterbank (bottom)
In a dB-scale the difference is quite obvious and the higher suppression of the sidelobes is remarkable.
Obviously, the higher factor L, the better is the bandpass characteristic, the window approaches a
sin(x)/x function, what results in an ideal rectangular filter shape.
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
3
FHNW
Selectivity DFT/ FFT | Window: Kaiser 9
0
-20
dB
-40
-60
-80
-100
-120
-5
-4
-3
-2
-1
-0.5
0
0.5
1
2
3
4
5
2
3
4
5
Selectivity Filterbank | Window: Def FT_1
0
-20
dB
-40
-60
-80
-100
-120
-5
-4
-3
-2
-1
-0.5
0
Bin
0.5
1
Fig. 4 Comparison selectivity curves for DFT/ DFT (top) and the filterbank (bottom)
in dB-scale
Appropriate Filterbank Windows:
The benefit of the filterbank is clearly visible in Fig. 4 with the highly improved filter shape. However,
this requires an appropriate window function.
The usual DFT "standard" windows, such as for example Hanning, Kaiser or BlackmannHarris windows simply stretched in the time domain from 1 to L frames are not appropriate
for the filterbank.
In the time domain the main peak of these windows is too wide, what results in a filter shape
whose mainlobe is too narrow.
This drawback is visible in Fig. 5a with the example of a Blackmann-Harris (4-term) window used for
the filterbank (what is even the better choice for a filterbank than for example a Hanning window).
Between two adjacent bins, the selectivity curve drops down.
Fig. 5b shows the impact for discrete spectral lines: The input signal is a sum of 3 harmonics placed
exactly at a bin, a third away from the bin and half way to the next bin.
The signal exactly at the bin leads to a single spectral line with highly reduced neighbor lines, whereas
the second harmonic is represented mainly in two adjacent spectral lines with different levels. The third
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
4
FHNW
harmonic leads to a pair of equivalent spectral lines, their level is however significantly reduced by
about 15 dB. This drop is called the scalloping loss.
Selectivity Filterbank Window: Blackman Harris 4-term (W=1) - Symmetric | NEWBN: 0.50109
0
dB
-50
-100
-150
-2.5
-1.5
-1
-0.5
0
0.5
1
1.5
Bin
Selectivity Filterbank Window: Blackman Harris 4-term (W=1)
2.5
1
H(f)
linear
|H|2(f)
0.5
0
-2.5
-1.5
-1
-0.5
0
Bin
0.5
1
1.5
2.5
Fig. 5a Selectivity function Blackmann-Harris (4-term) window used in the filterbank
Filterbank Pxx | Window : Blackman Harris 4-term (W=1) | Signal: Harm @ bins: 205 | 240.33 | 280.5 | plus noise
-20
-40
-60
dB
-80
-100
-120
-140
-160
200
210
220
230
240
250
bin
260
270
280
290
300
Fig. 5b Filterbank output Pxx for harmonics @ bin 205| 240.33 and 280.5
showing significant scalloping loss of about 15 dB
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
5
FHNW
The reduction in the displayed level is caused by the too narrow filter shape. The half power width (|H|2
is reduced to 50%) for the stretched Blackmann-Harris window is approximately ± 0.25 bin, as shown in
Fig. 5a.
Other windows even place a zero between neighbor bins, hence spectral lines might even be suppressed.
For the filterbank an appropriate filter shape is optimized to have a flat top level and a fast
roll-off at +/-0.5 bins.
For L = 4 the family of flat top windows matches these requirements. In the context of the
DFT these windows have a "very wide" selectivity curve, the 3-dB width is approximately 4
(3…5) bins and also the normalized equivalent noise bandwidth (defined below) is in the
range of 4 bins. These windows have been developed for the DFT to have a negligible drop
in the range of -½…½ bin.
The flattop window stretched in the time domain by a factor L=4, leads to a very suitable
filter shape of width 1 bin in the filterbank context.
The flattop windows are constructed by a series of cosine terms, there are published variants with 2 to 10
terms [2]. All variants are a tradeoff between the width of the mainlobe and the sidelobe suppression and
decay. More than a dozen of variants have been published.
The performance of an appropriate filterbank flattop window shows Fig. 6. The half power width is
nearly ± 0.5 bins, as visible in Fig. 6a.
Selectivity Filterbank Window: Default Window (Flattop), L=4 - Symmetric | NEWBN: 1.0547
0
dB
-50
-100
-150
-2.5
-1.5
-1
-0.5
0
0.5
1
1.5
Bin
Selectivity Filterbank Window: Default Window (Flattop), L=4
2.5
1
H(f)
linear
|H|2(f)
0.5
0
-2.5
-1.5
-1
-0.5
0
Bin
0.5
1
1.5
2.5
Fig. 6a Selectivity curve of an appropriate filterbank (L = 4) window
of type flattop
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
6
FHNW
Filterbank Pxx | Window : Default Window (Flattop), L=4 | Signal: Harm @ bins: 205 | 240.33 | 280.5 | plus noise
-20
-40
-60
dB
-80
-100
-120
-140
-160
200
210
220
230
240
250
bin
260
270
280
290
300
Fig. 6b Filterbank output Pxx for harmonics @ bin 205| 240.33 and 280.5
scalloping loss reduced to about 2.6 dB
Fig. 6b demonstrates that harmonics between bins are displayed with only a small deviation of 2.6 dB,
side lines/ lobes are highly suppressed.
An important window property already mentioned is the normalized equivalent noise bandwidth
(NEWBN). If the signal is white Gaussian noise, the bandpass filter associated with a bin "collects"
noise power which is compared to an idealized rectangular bandpass filter of width NEWBN. The flattop
window above (Fig. 4 and 6) has a value of 1.055 whereas the value of the Blackmann-Harris window
(Fig. 5) is 0.501.
A good filterbank window has an NEWBN of about 1 (bin). Both, the 3 dB bandwidth and the NEWBN
should be close to 1.
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
7
FHNW
2) Filterbank Operation and Realization
Fig. 7 shows the usual mode of operation with a "standard" DFT window and the wider filterbank
window (L = 4). The FFT window cuts out N samples and processes adjacent non-overlapping time
slots/ frames. The filterbank comprises L⋅N samples, the shift interval is however the same.
Remark:
There are also DFT modes with overlapping time slots, the processing load is obviously increased. In case of nonoverlapping intervals a side effect of the DFT is, that the signal near the frame borders is blanked out and is "lost".
On the other hand, the filterbank window has some overlap and thus correlated parts of the signal. Due to the fact
that an "optimal" filterbank window concentrates its mainlobe in the center part, the correlation is weak.
These properties are of some importance for long term observations with accumulated power spectra with respect
to the statistical smoothening of the spectra. In any case the filterbank is more advantageous, thus requires less
observation time than the standard DFT.
t
FFT Window
FFT 1 FFT 2
…
Fil 1
Filterbank
Window
Fil 2
…
FFT
1 Frame wide
N Samples
Filterbank
L Frames wide
L⋅N Samples
Fig. 7 Comparison DFT and filterbank operation in time domain
Fig. 7 suggests that the filterbank corresponds to an (L⋅N)-point FFT. This however implies that the
frequency-/ bin-scale would be refined by a factor of L and the overlap between adjacent bins still exists.
In addition, the (L⋅N)-point FFT would enhance the computational load, measured in complex
multiplications, with respect to an N-point FFT according to:
(L⋅N/2)⋅log2(L⋅N) = K ⋅ (N/2)⋅log2(N)
for L = 4 and N = 215 factor K is 4.53.
This is however not intended: According to Fig. 3 the bin spacing should be identical, but with improved
filter shape.
Obviously there is a link between the (L⋅N)-point FFT and the filterbank as shown in Fig. 8.
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
8
FHNW
Signal Frame:
L⋅N Samples
Filterbank Window
t
L⋅TF
Filterbank-Spectrum:
(Signal x Window)
Scalar Product
with:
∆f = 1/(L⋅TF)
DC
t Bin: 0
f
8 … (LN-1)
4
1 Period
2 Periods
3 Periods
4 Periods
5 Periods
Bin: 5
Fig. 8 Link between (L⋅N)-point FFT and filterbank (right), L=4 in this example
The filterbank output corresponds to the (L⋅N)-point FFT output keeping every L-th bin,
omitting all the others bins.
Concluding from Fig. 8, the filterbank computes the scalar products according to Fig. 9:
Filterbank Frame: L⋅N Samples
Filterbank Window
Filterbank-Spectrum:
t
Compute only every L-th
DFT Bin
→ N Bins
L⋅TF
I
II
III
Scalar Product
IV
∆f = 1/(L⋅TF)
DC
t Bin: 0
4
f
8 … (LN-1)
4 Periods
8 Periods
Bin: k⋅L
Fig. 9 Filterbank principle and corresponding base functions (harmonics)
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
9
FHNW
Fig. 9 shows that in any of the time slots or "segments" I … IV (L = 4), the related base function along
the time axis is identical, the pattern is replicated. To compute the scalar product it is therefore allowable
to add first the signal segments I … IV and to multiply then the sum with the base function assigned to
one of the time slots.
This procedure is shown in Fig. 10, left side, in the literature it is named as the overlap-add method or
taking into account the window function weighted overlap-add (WOLA).
I
w11
II
III
w1N
IV
N Samples
Window Multiplication:
FIR Polyphase Pre-Filter
N
w4N
w41
w11
Scalar Product
DC
0
FFT
I
II
III
IV
Σ
Overlap and Add
Segments I…IV
N
w31
N
w4N
1 Period
N
Point
N
w3N
w1N
N-1
2 Periods
n Periods
Fig. 10 Filterbank implementation with the weighted overlap-add (WOLA) method: Principle (left),
parallel implementation (right)
Fig. 10 also makes clear, that the scalar product of the overlapped and added segments with the base
functions corresponds to an N-point FFT (the base functions comprise 0, 1, 2, … periods as in the DFT).
Therefore, the filterbank consists off an N-point FFT extended with a pre-computation stage which
carries out the window multiplication and the overlap-add operation.
The pre-computation stage may be organized as N FIR filters of length L, as shown in Fig. 10 on the
right side. The shift registers store the 4 signal segments/ frames, whereas the coefficients are the
equispaced sample points of the window. This set of coefficients in connection with the FIR filter is also
denoted as polyphase filters, hence this filterbank implementation is also named a polyphase filterbank.
The FIR pre-filters cause an additional computational load of N⋅L real multiplications. Compared with
the N-point FFT itself the computational load is enhanced by a factor of only 1.13.
Literature
[1] Frederic J. Harris, On the Use of Windows for Harmonic Analysis with the Discrete Fourier
Transform, IEEE proceedings, Vol. 66, No. 1, January 1978
[2] G. Heinzel, A. Rüdiger, R. Schilling, Spectrum and spectral density estimation by the Discrete
Fourier Transform (DFT), including a comprehensive list of window functions and some new flattop windows, Max-Plank-Institut für Gravitationsphysik, February 15, 2002
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
10
FHNW
Release Notes:
Version
Datum / Autor
Status
V1.3
24. Feb. 2015/ B. Stuber
Update
V1.4
12. March 2015
Minor changes
B. Stuber
RatherFilterbank_than_FFT_V1p4_12March15.docx
11
Download