Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Display,

actuators,
Sensor Input Processing Output signals,
control

An Introduction
to FFT andTime
Domain Windows
Part 11 in a series of tutorials in
instrumentation and measurement
Sergio Rapuano and Fred J. Harris

A
student in a digital signal processing class soid. No other wave shape can make that claim! The
once asked an insightful set of questions. sinusoids preserve their identity in a linear system; the
They went something like this: “Professor, system can change the sinusoid’s amplitude and phase
can you explain why we spend so much of our time but it cannot change its basic structure. Sinusoids are
describing signals in the frequency domain? We first ex- eigenfunctions of linear, constant-coefficient, differ-
amined circuits in terms of their sinusoidal steady-state ential equations. As such, the sinusoids can be used to
response. We then went on to study Fouri- analyze and characterize the linear system.
er series and Fourier transforms, and The collection of amplitude and phase
we are now studying sampled changes experienced by sinusoids
data Fourier transforms, and of different frequencies passing
the Discrete Fourier trans- through the system compactly
form, all based on sinusoids describes the system. We call
and sampled data sinu- this description its frequency
soids. Why not use other response. The frequency re-
basis functions? What is so sponse is intimately tied to
special about sinusoids?” the system’s transfer function
Great questions! We wish and its differential equation.
we had thought to ask them! The Fourier transform is also
The answers are simple. used to describe signals in the time
Many of the dynamic systems we or spatial domains. We limit our dis-
analyze, synthesize, design, develop, cussion here to time domain descriptions.
and operate can be approximated by linear Signals of interest are decomposed into a set of
time invariant systems modeled by linear, constant- complete orthonormal basis functions, the real sines and
coefficient, differential equations. So now the question cosines, or, equivalently, the set of complex exponentials
is, “What does that mean?” It means this: if we dif- [3]. The classic Fourier transform is the mechanism that
ferentiate a sinusoid, it is still a sinusoid. If we form a performs this decomposition, leading to a frequency
weighted sum of derivatives of a sinusoid, the sum is domain description of the signal. There are several ad-
still a sinusoid. The sinusoid never stops being a sinu- vantages to analyzing signals in the frequency domain.

32 IEEE Instrumentation & Measurement Magazine December 2007


1094-6969/07/$25.00©2007IEEE
Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
Display,
actuators,
Sensor Input Processing Output signals,
control

Probably the most evi- the sum to 0 to acknowl-


dent is the relevant in- edge causality and to
crease in dynamic range
What is so special about obtain the one-sided DFT
in comparison with time sinusoids?…The sinusoid as a sum from 0 to +∞. The
domain methods. Frequency practical consideration is that
domain analysis can resolve: never stops being a we can never perform an infi-
measure and detect the ampli- nite sum in a computer. We have to
tude and phase of overlapped
sinusoid. No other limit the range of the sum to a finite
signals the amplitudes of which differ waveshape can interval, say, 0 to N − 1, a sum contain-
by orders of magnitude. This powerful ing N terms. This little detail essentially
characteristic makes frequency domain make that turns the data collection process on at in-
measurements important in many fields, dex 0 and then turns it off at index N − 1. This
including telecommunication, instrumenta-
claim! gating operation means that the sum is always
tion, radar, sonar, consumer entertainment, and performed over finite data collection apertures,
other systems requiring signal analysis, signal with boundary conditions equivalent to an abrupt
detection, modulation, and demodulation. turning on and off of the collected data. Turning data
The Fourier theory had originally been formu- abruptly on and off has an undesired influence on the
lated for continuous time and amplitude signals, i.e., spectrum of the collected signal samples. We ameliorate
analog signals and systems. With the advent of the digi- this effect using a multiplicative weighting term applied to
tal computer, in particular of the microprocessor, spectrum the data in the collection interval, which slowly and gently
analysis could be performed in the digital domain along turns the data on and off at the boundaries. This is a common
with many of the other signal processing tasks performed operation in many signal processing systems facing finite ap-
by digital techniques. The sampling theorem was well es- ertures. In time-series signal processing we call the weighting
tablished prior to the arrival of the digital computer, and the function a window, in spatial processing (beam forming) we
missing components required to perform signal processing call it a shading function, and in photolithography we call it an
on sampled data signals were the transducers to pass sig- apodizing function.
nals back and forth between the continuous domain and the The DFT is implemented in digital systems by a family of
sampled data domain. The need for high-performance, low- algorithms collectively known as the fast Fourier transform
cost analog-to-digital converters (ADCs) and their duals, (FFT). The FFT offers a significant reduction in computational
the digital-to-analog converters, was recognized early on, workload relative to the DFT. The DFT requires on the order
and their development closely paralleled that of the micro- of N2 complex operations (multiplies and adds), while the
processor. It is interesting to note that the first applications FFT can be implemented with workloads between 2 × N and
of sampled data signal processing occurred in the sampled log2(N) × N/2 complex operations. Some information on FFT
data control area because the required sample rates were history can be found in [4]. The FFT is widely applied in digital
low, as were the bandwidths of the mechanical systems being signal processing–based systems. [5] These include modula-
controlled. The next application was that of processing audio tion and demodulation applications in telecommunication
signals, also with a relatively low bandwidth matched to systems, with examples being Orthogonal Frequency Domain
the then-improved performance capabilities of early ADCs. Multiplexing (OFDM) and Asymmetric Digital Subscriber
This evolution is seen in the publication history, with the first Lines (ADSL) and measurement and instrumentation systems,
venue for signal processing articles being the IEEE Journal on the emphasis of this paper. Processing a finite aperture obser-
Audio and Electroacoustics (1965), which morphed into Audio, vation introduces several artefacts into the spectral analysis
Speech, and Signal Processing (1984), on its way to becoming process. One important artefact is spectral leakage, the spill-
the Transactions on Signal Processing (1991). ing of energy centered at one frequency into the surrounding
The mathematical tools were ready and waiting as the spectral regions. This effect limits our ability to reliably detect
enabling technology and applications came together in the low-level signal in the presence of nearby high-level signals.
early 1960s. When digital data (the sampled and quantized Windows are designed and applied to suppress this artefact.
representation of an analog signal) were delivered by ADCs to A second attribute brought to bear by the finite aperture is the
the digital domain, they found a rich body of signal processing uncertainty principle. The finite aperture limits spectral re-
options ready to manipulate and extract signal parameters. solvability, the ability to detect closely spaced similar-strength
The Z-transform had already been developed as the sampled tones as individual signal components [3]. What we will learn
data counterpart to the Laplace transform, and the discrete here is that when we apply a window to the signal to control
Fourier transform (DFT) had been developed as a counterpart biases due to spectral leakage, we increase the width of the
to the Fourier transform (FT). One modification to the DFT was spectral main lobe, which causes secondary effects related to
required to perform machine computation of the sampled data spectral resolution (separating nearby signals), processing
spectrum. The DFT is defined as a sum over a two-sided inter- gain (separating signals from noise), and window overlap (sat-
val from −∞ to +∞. In practice we often change the lower limit of isfying Nyquist). We will examine and highlight these effects.

December 2007 IEEE Instrumentation & Measurement Magazine 33


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
The paper is intended to give the basic elements of FFT- of the periodic signal, as is shown in Equation 5. What we
based spectrum analysis, starting with the properties of the realize here is that sampling in the frequency domain induces
DFT and introducing considerations related to its fast imple- periodicity in the time domain. The converse, of course, is also
mentation. We examine the default window, the rectangle, true: sampling in the time domain induces periodicity in the
and its contribution to spectral leakage, as well as designed frequency domain and results in the sampled data Fourier
windows and how they can be used to obtain accurate spec- transform (SDFT):
tral estimates. Finally, we discuss and compare the main
characteristics of the windows used in spectrum and network
measurements along with information on their secondary
attributes.
(5)
The Discrete Fourier Transform The FT and the FS are applicable to analog signals. That
The mathematic tool for analyzing signals and systems means that FT and FS describe continuous time signals and
in the frequency domain is the FT. When applied to a real have continuous and discrete spectra, respectively, with
or complex valued analog signal x a(t), it produces its as- arbitrary amplitude and phase profiles. All mathematics
sociated frequency domain representation, Xa(f), called its associated with the Fourier theory is applicable to digital sys-
spectrum. The basic idea behind spectrum analysis is that, tems. The SDFT is defined for sequences of arbitrary length
subject to easy-to-satisfy restrictions, a signal can be formed and is the counterpart of the inverse FS. By the application of
as a weighted sum of complex exponential functions (called appropriate windows, the SDFT can process finite length se-
spectral components). The weighting terms at each frequency quences. The SDFT is shown in Equation 6. Here the variable
are the complex amplitude and phase. Spectral analysis is the θ is digital frequency with units of radians/sample, bounded
process by which we estimate the amplitude and phase of the by the interval −p < q ≤ p, which reflects the mapping of
components located at each frequency. For this reason, Xa(f) sampled data spectra to the unit circle; it reflects as well the
is a complex signal, the magnitude of which represents the Nyquist criterion for the sampling process. Since the empha-
sinusoid’s amplitudes versus frequency, which we denote sis here is finite sums, we also present the finite sum version
the magnitude spectrum of xa(t), and whose phase represents of Equation 6 in Equation 7. Note that the SDFT is continuous
the sinusoid phases versus frequency, which we denote the and periodic in 2p, even though the time series is a sampled
phase spectrum of xa(t). data series:
An aperiodic signal has frequency domain representation
defined by the FT integral shown in Equation 1, as follows:

(1)
with an inverse transform integral as shown in Equation 2:

(6)
(2)
When xa(t) is periodic in T0 s, the spectral components are
harmonics located at multiples of the fundamental frequency, (7)
1/T0 Hz. The signal xa(t) can be represented, in the mean square
sense, with a countable sum of sine waves by the Fourier Series The inverse SDFT (of Equation 6 or Equation 7) is shown in
(FS) [1] integral shown in Equation 3. The resulting magnitude Equation 8 and is seen to be the sampled data counterpart of
and phase spectra reside only at the integer multiples of the Equation 3:
frequency 1/T0, or k/T0.

(8)

(3) Again we return to the reality that we can only perform


finite sums with a digital machine. By similar reasoning, we
with an inverse transform sum as shown in Equation 4: can only compute the spectrum shown in Equation 7 at a finite
number of frequencies. We elect to sample the spectrum of
Equation 7 at multiples of the digital frequency 2p/N, where
N is the number of samples in the original sum. This is suffi-
(4) ciently dense sampling to satisfy the Nyquist theorem for this
Note that within a scale factor, the FS (Equation 3) of a sampling process. This sampling is shown in Equation 9. The
periodic signal is a sampled FT (Equation 1) of a single cycle sampling process converts the SDFT to the DFT.

34 IEEE Instrumentation & Measurement Magazine December 2007


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
Display,
actuators,
Sensor Input Processing Output signals,
control

the spectral product of their N-point DFTs. One of the


sequences may have to be zero extended to length N.
◗ Perform linear convolution of two sampled signals as the
(9)
2N-point IDFT of the spectral product of their 2N-point
The inverse DFT, which is the finite sum replacement of DFTs. Both N-point sequences must be zero extended to
Equation 8, is shown in Equation 10. length 2N.
◗ Determine the frequency response of a sampled data
system as the ratio of the N-point DFTs of the windowed
output and input series.
(10) ◗ Synthesize the time-domain sampled waveform from its
frequency domain representation.
The main advantage of the DFT over the FT is that it permits
An important observation is that X(k) is a periodic set of machine computation of spectra.
frequency samples due to the original time domain sampling The DFT is a vector process, converting input time vectors
process. The positive frequencies are located at indices 0 ≤ k ≤ of length N into output frequency vectors of length N. One
N/2, and since index N is congruent to index 0, the negative matter of concern in applying the DFT is the high computa-
frequencies −1 ≥ k ≥ −N/2 are located at N − 1 ≥ k ≥ N/2. Simi- tional burden of N2 complex operations to convert the input
larly, x(n) has become a periodic set of time domain samples, vector to the output vector. A second matter of concern is that
periodic in N samples, due to the sampling of the spectral the spectral sampling inherent in the DFT describes the peri-
function. odic extension of the input signal, which may produce spectral
Note that quantization of sampled data sequence has no artefacts as a result of the artificial boundaries.
bearing on the properties of the SDFT. The quantization noise The first concern has been put to rest by the development of
can be attributed to source coding noise and is treated as addi- efficient FFT algorithms, which require significantly reduced
tive noise, which is seen as one of the noise terms in the spectra computational resources to perform the transform. The second
when the spectra is computed by finite precision arithmetic concern is handily addressed by the use of windows to sup-
processors. press the boundary conditions, which in turns suppresses the
Summarizing this section, we can say that spectral leakage artefacts.
◗ Sampling an analog signal at frequency FS induces peri-
odicity of its spectrum with period FS or with normalized Efficient Calculation of DFT,
period 2p. the FFT Algorithm
◗ The DFT forms equally spaced samples of the periodic The DFT is seen to be a set of projections of the input time
sampled data spectrum. series onto the basis vectors W nkN, where WN is the Nth root of

◗ Sampling the periodic spectrum of the input sequence unity, . The projections are performed as N-point inner
at multiples of FS/N induces periodicity of the input se- products, with each projection requiring N complex multiply
quence with period N. and add operations. Thus, N2 complex multiplications are re-
◗ The samples in the frequency domain are equally spaced quired for the direct computation of the DFT. FFT algorithms
at multiples of FS/N; therefore, spectral values differ- exist for any composite length N DFT. By composite we mean
ent from kFS/N are not available from the N-length N is factorable into a product of factors: i.e., N = N1 × N2. For
transform. The frequency interval FS/N defines the instance, consider the factors of N = 800 with one possible
transform frequency resolution, and the frequencies factoring of 32 and 25.
kFS/N are denoted frequency bins. Many FFT algorithms operate by the divide-and-
◗ Additional frequency resolution can be conquer method. In this process, the transform is
obtained for a sequence of length N by partitioned into a sequence of reduced-length
performing a 2N or 4N-point transform The transforms that are collectively performed with
on the zero-extended versions of the main reduced workload. For instance, a data vector
sequence. of length N = N1 × N2 is mapped to a two-di-
advantage mensional intermediate array of dimen-
Applications of the DFT sion N1-rows by N2-columns. We per-
By using the DFT and its properties, it of the DFT form a two-dimensional transform
is possible to do the following: over the FT is that by N1 transforms over the row vec-
◗ Compute the spectrum of a tors of length N2, which requires
sampled data signal. it permits machine N1N22 operations followed by
◗ Perform circular con- N2 transforms over the col-
volution of two sam- computation of spectra. umn vectors of length N1,
pled signals as the which requires N 2 N 12
N-point IDFT of operations. Depend-

December 2007 IEEE Instrumentation & Measurement Magazine 35


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
Fig. 1. Log magnitude plots of the FFT of complex and of real noisy sine wave at 1.7 kHz sampled at 10 kHz with spectral cuts at Fs and at Fs  /2.

ing on the details of the one-dimensional to two-dimensional in successive 50% workload savings. The radix-2 transform
mapping, there may be a set of phase rotations, called twiddle requires twiddle factors between successive partitions. The
factors, applied to the output of the first set of transforms prior iterative partitioning operation can be repeated until the proc-
to application of the second set. The total workload for the ess performs 512 two-point transforms, which are combined to
two-dimensional transform is seen to be N1N22 + N2N12 = (N1N2) obtain 256 four-point transforms, which in turn are combined
(N1 + N2), which, simply stated, is the sum of the factors times to obtain 128 eight-point transforms, continuing until two
the product of the factors. The workload for the original, un- 512-point transforms are combined to form the 1,024-point
factored DFT is N2 = (N1N2)(N1N2). The ratio of the workloads transform [1]. Each successive combining operation requires
is seen to be the sum of the factors divided by the product of N/2 complex multiplications. The number of combining steps
the factors, R = [(N1N2)(N1 + N2)/(N1N2)(N1N2)] or R = (N1 + is equal to the number of times the array length can be parti-
N2)/(N1N2). With the factors for N = 1,000 of 32 and 25, this tioned 1 to 2 (or halved), which is log2(N). Consequently, the
ratio is seen to be (32 + 25)/(32 × 25) = 0.071. Here we see that total number of complex multiplications required to calculate
the factored form requires only 7.1% of the workload of the a radix-2 FFT is N/2 log2(N).
unfactored form, a savings of nearly 93%. The factoring pro- To give an idea of the computational efficiency of the FFT
cess is nested, with the 25-point transforms performed as two- algorithm over the direct DFT calculation, consider the DFT
dimensional transforms over 5-by-5 arrays and the 32-point of length 1,024. The savings ratio is [N/2 log2(N)]/[N2] or
transforms performed as 2-D transforms over 4 × 8 arrays. log2(N)/(2N) = 10/2,048 or 0.0049, a savings of 99.5%. The
A common-length FFT is known as the radix-2 DFT, which actual numbers are 5,120 operations for the FFT, compared to
performs successive halving of the length N DFT, with N being 1,048,576 operations for the direct DFT computation.
a power of 2, such as 210 = 1,024. The partition described above The output of an FFT is a vector of length N, obtained by
starts with a two-dimensional array of length N/2 by 2, which sampling the periodic spectrum of the sampled data signal at
results in a savings ratio of (512 + 2)/(512 × 2) = 0.502, a sav- the frequencies kFs/N. It is common to call these spectral lo-
ings of nearly 50%. Each successive iterated partition results cations frequency bins. The periodic spectrum is visualized on

36 IEEE Instrumentation & Measurement Magazine December 2007


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
Display,
actuators,
Sensor Input Processing Output signals,
control

Fig. 2. Top; analog 2 kHz sine wave and spectrum; middle: 3 ms rectangular window and spectrum; bottom: windowed sine wave and spectrum.

a circle of circumference Fs or in normalized units of 2pf/Fs. As frequency bins from 0 to N − 1. In the redefined spectral cut
we unwrap the circle to map it to a line, we traditionally cut the indices are mapped to –N/2 to +N/2 − 1, or in normal-
the circle at angle 0 so that the line extends over the interval ized coordinates, (−0.5 to +0.5). For complex signals the DFT
[0 to 2p), closed on the left, open on the right. The spectrum is asymmetrical and the entire span (−0.5 to +0.5) is pre-
obtained by this cut has frequency 0 at the far left, positive sented, and for real input signals, the DFT is Hermetian sym-
frequencies extending to the right until the mid-point, at metric, so a reduced span of (0 to +0.5) is presented, since the
which point we have the half sample rate, beyond which we positive frequencies, the first N/2 + 1 samples, are sufficient
have the negative frequencies. The FFT computes samples of to represent the signal spectrum. Figure 1 presents the log
the spectrum at increments of 2p/N, indexing the samples magnitude spectrum formed by an FFT of a complex and of a
from 0 to N − 1. Sample N is congruent to sample 0 and is, in real 1.7 kHz sine wave with AWGN (Additive White Gauss-
fact, the start of the next spectral period. Thus, sample −k is ian Noise) sampled at 10 kHz. Here we see the spectra with
the same as sample N − k and the frequencies with negative and without the redefined spectral cuts. As can be seen, the
index; the negative frequencies are located in the second half spectrum of the complex signal is asymmetric and the spec-
of the interval. It is common in spectral displays to redefine trum of the real signal is symmetric about both Fs/2 and 0.
the cut on the circle to be located at angle p to redefine the
interval as (−p to p). In this form the center of the display is 0 Spectral Leakage
frequency, with negative frequencies located to the left and As described earlier, the DFT computes samples of the pe-
positive frequencies located to the right. MATLAB uses the riodic spectrum X(q) associated with the N-point sampled
command fftshift to redefine the spectral cut. The result of data sequence {x(n)}. Sampling in the time domain causes
FFT calculation is a double-sided spectrum mapped to the replication (or periodic extension) of the spectrum, with rep-

December 2007 IEEE Instrumentation & Measurement Magazine 37


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
licas positioned at multiples of 1/T, the reciprocal of spacing interval), indicating a single sinusoid in the time series.
between time samples (T =1/Fs). Similarly, sampling in the The infinite extent sinusoid has a FS at a single frequency
frequency domain causes replication (or periodic extension) k/(NT). By including distribution functions in the FT, we rep-
of the time series, with replicas positioned at multiples of NT, resent the spectrum of a complex sine wave by a delta function
the reciprocal of the spacing between the frequency samples δ(f − k/NT). When the complex sinusoid is time limited to a
(Fs/N =1/NT). This property can be illustrated by computing finite support of length NT seconds, its spectrum is modified.
the N-point DFT of a sampled sequence that contains an inte- The altered spectrum is obtained by convolving the transform
ger number of cycles in the sequence of length N. A complex of the infinite extent version, δ(f − k/NT), with the transform of
sinusoidal sequence containing an integer number of cycles in the truncating function, WR(f), defined as follows:
N samples is defined in Equation 11.

(12)

This function is called rectangular window of length NT,


and its FT WR(f) is the ubiquitous function sin(pt/NT)/(pt/
NT), commonly denoted sinc(t/NT) [1]. Figure 2 shows a
segment of the input sinusoid xa(t), the window wR(t), and
(11)
the windowed signal xa(t) × WR(t), as well as their spectra
For this sequence the periodic extension of the N-sample se- Xa(f), WR(f), and Xa(f)*WR(f), where the symbol * denotes a
quence is the same as the samples obtained by sampling the convolution.
original sinusoid, the original signal. The DFT of the sequence The same results will be observed in the sample data
has a non-zero spectral component at index k (for k cycles per domain. The process of acquiring a finite-length record of
a signal can be modeled as
sampling and analog-to-digi-
tal conversion of an infinite
number of samples followed
by the multiplication of the re-
sulting infinite sequence {x(n)}
by a discrete window function
{w(n)}, the values of which are
non-zero within a specified
span of N samples. If, in the
example considered above, the
(a)
sampling period T = 1/Fs and
the acquisition time interval Ts,
and the signal period, T0, are
chosen to satisfy the relation

(13)
the FFT will have the appear-
ance shown in Figure 3. In this
(b) example, the sampled signal is
a 2 kHz sine wave with a period
equal to 0.5 ms that is sampled
at a 20 kHz rate. The sampling
period is 50 μs and covers a 3
ms time interval spanning six
cycles of the sine wave to col-
lect a total of N = 60 samples.
The FFT values will be zero
for all frequency bins except
(c) for the one corresponding to 2
kHz, because a sample is taken
Fig. 3. Top: sampled and windowed 2 kHz sine wave; middle: mid: single-sided spectrum of signal; bottom: DFT
at the peak of the main lobe of
samples of sampled sine wave. Xa(f) *WR(f), while all the others

38 IEEE Instrumentation & Measurement Magazine December 2007


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
Display,
actuators,
Sensor Input Processing Output signals,
control

are taken at the zeros of the same


spectrum. Note that in this case,
with the sinusoid containing
an integer number of cycles per
interval, there is no uncertainty
in estimating the sine wave fre-
quency and amplitude.
Almost assuredly, we will not
see signals in which all the spec-
tral components have an integer
(a)
number of cycles per interval of
length N. More likely, the periods
T 0 are arbitrary and unknown
and there isn’t an integer k that
satisfies the condition (Equation
11) for a given N and a selected
sampling period T. In these cases
the frequency components cor-
responding to the FFT bins will
not correctly represent the am- (b)
plitude and spectral position of
the underlying spectral peaks
and further will observe the side
lobe spectral terms related to the
offset spectral peaks, which spill
spectral components over all the
frequency bins.
For example, let us consider
the case of the sine wave xa(t) and
suppose that T 0 is not known. (c)
Let us suppose that NT = 6.5 T0, Fig. 4. Top: sampled and windowed 2.2-kHz sine wave; middle, single-sided spectrum of signal; bottom: DFT
as shown in Figure 4. The peri- samples of sampled sine wave. Note samples of spectral side lobes.
odically extended version of this
sequence will have a discontinu-
ity at each N sample not present in the original non-windowed the spectra of the high-level signals could mask or cover
sequence. The FT of this sequence is the same shifted sinc the spectra of the low-level components with its side lobes.
function as in the previous example, but the zero crossings no Closely spaced spectral components may have overlapping
longer correspond to the DFT sample positions. Consequently, main lobes, which may reduce our ability to resolve them as
the DFT will now compute samples of the side lobe rather than separate components.
samples of the zero crossings. This phenomenon is called spec- Spectral leakage of window spectral side lobes is respon-
tral leakage. As with the continuous FT, the original spectrum is sible for (i) errors in estimating the frequency and amplitude
the convolution of Xa(f) and WR(f), with the sample positions of the frequency components from the FFT bins and (ii) a
fixed but the zero crossings translated with the center of limitation of system dynamic range as a result of the mask-
the sinc. Note that the sample values in the main lobe do ing affect of strong components on weak components.
not coincide with the peak of the main lobe. Using this Spectral width of the window’s spectral main lobe is
result to estimate the signal parameters will lead to responsible for the minimum separation required
an error in frequency and amplitude. A typical peak between two frequency components of similar
detection algorithm will find a sine wave with amplitude to assure reliable detection of distinct
frequency 2 kHz and magnitude 0.35, instead A signal components. This separation, called
of 1.1 kHz and 0.50, respectively. minimum resolution bandwidth, also reduces
The errors in measuring the signal fre-
common- the capability of detecting weak frequency
quency and amplitude are related to the length FFT components near strong components.
frequency resolution and the main lobe Spectral leakage cannot be avoided
width. If the signal is composed of
is known as the when the signal components are un-
many frequency components with radix-2 DFT…. known. Proper design trades be-
wide variation in amplitudes, tween spectral resolvability and

December 2007 IEEE Instrumentation & Measurement Magazine 39


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
the sine wave. The known
bias in amplitude due to the
reduced-amplitude main
lobe of the Hann window
relative to the rectangle
window is easily removed.
The amplitude of each win-
dow is simply the sum of
the window coefficients
and can be properly scaled
out after the measurement.
The residual amplitude er-
ror resulting from position
of the center lobe relative to
the DFT fixed sample posi-
tions is known as scalloping
loss. This loss is smaller
than the loss obtained with
the rectangle window.
This loss can also be to-
tally removed by passing
a second-order polynomial
through the three maxi-
mum-amplitude log-mag-
nitude samples in the main
lobe and by determining
the peak position and am-
plitude of the parabola.
This works amazingly well
because in log amplitude,
all spectral windows are
approximately parabolas.
Fig. 5. Effects of the Hann window. Top: windowed sine wave; middle: single-sided spectrum of windowed signal; bottom: To reiterate, we comment
DFT samples of windowed and sampled sine wave. that good windows reduce
the side lobe levels, thus
detection capability are required to reduce errors in amplitude improving the detectability of weak frequency components,
and frequency estimates. and the errors made by estimating each component frequency
and amplitude can be easily eliminated by polynomial in-
Windows terpolation. An alternate interpolation option is obtained by
Instead of the rectangular window, other window functions simply zero extending the length-N–windowed time series to
are generally adopted to control the limitations listed above. length 2N or 4N and performing the increased length DFT.
All well-designed windows have the characteristic of going In Figure 6, we show examples of the time and frequency re-
gently and smoothly to near-zero values at the boundaries sponses of windows most often used in digital spectrum analysis
of their support intervals. Consequently, the discontinuities [1], [6]. The choice of the window may vary for a specific applica-
at the boundaries of the periodically extended sequence are tion, as each has different effects on the FFT output. Generally, a
suppressed as the amplitudes and many order derivatives window with a very narrow main lobe will have a high spectral
are matched at the boundaries. As illustrated in Figure 5, the resolvability and a lower uncertainty in measuring the frequency
window modifies the input signal by smoothly and gently of a spectral component. In most cases, a narrow main lobe implies
bringing the signal envelope to near-zero values at the bound- high side lobes causing low detectability of weak spectral compo-
aries of the acquisition interval. The result will be a controlled nents. In addition, a narrow main lobe will cause a commensu-
insertion of leakage. rate uncertainty in the measurement of the spectral component
Examining the DFT samples shown in Figure 5 we see that amplitudes as a result of high scallop loss. For example, the Hann
the samples far removed from the main lobe are quite small window is the window of choice in applications requiring high
and will reduce the masking effects due to high side lobes. We resolvability. As a result of its narrow main lobe, the frequency
also see the multiple samples of the main lobe, which reduces resolution is maximized and the frequency measurement uncer-
our ability to estimate the center frequency and amplitude of tainty is minimized. However, because of the higher side lobes,

40 IEEE Instrumentation & Measurement Magazine December 2007


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
Display,
actuators,
Sensor Input Processing Output signals,
control

Fig. 6. Time and spectral response of common window functions: rectangular, Hann, Kaiser-Bessel, and Harris Flat-Top. The width of the rectangular window
main lobe is overlapped to the other window spectra as dashed red lines to easily compare them.

the detectability of low-level nearby spectral terms is reduced in characteristics of the window frequency response. In [3], [7], and
comparison with other windows. The uncertainty of the ampli- [8], a complete description of them is given in mathematical and
tude measurement is greater than for windows designed for low practical terms. Here some parameters are recalled and briefly
scallop loss, such as the harris Flat Top window. As a result of the introduced in order to give some indications on how to interpret
wide flat spectral response, the Flat Top has small scallop loss and them for finding the right trade-off for a given application.
hence exhibits small amplitude errors, but the same flatness leads
to significant frequency uncertainty, which must be resolved by Minimum Resolution Bandwidth
one of the spectral interpolation options. As described above, as a result of the convolution of the sig-
The Flat Top window, on the other hand, has a flat but very nal and the window spectra, the windowed signal spectrum
wide main lobe and lower side lobes. The Kaiser-Bessel win- includes a replica of the window frequency response located
dow, with a time-bandwidth parameter, β, offers a selectable at each frequency component of the signal, resulting in an
trade between side lobe levels and main lobe width. Some
digital signal processing systems offer the option to select a
window from a set to give the user more degrees of freedom
in the analysis. In all cases the user should be aware of the ef-
fect of the windows on the measurement results. A complete
introduction to the windowing techniques as well as a review
of more window characteristics can be found in [3].

Windows Characterization
There are several figures of merit used for classifying the win- Fig. 7. Overlapped components that cannot be distinguished (one peak) and
dows used in digital spectrum analysis. All parameters refer to that can be distinguished (two peaks) [3].

December 2007 IEEE Instrumentation & Measurement Magazine 41


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
of spectral decay is also
1/f but has even lower side
lobes because of its even-
smaller discontinuity.

Processing Gain/Processing
Loss
The amplitude estimation
of a frequency component
is affected by the broad-
band noise passed by the
bandwidth of its spectral
main lobe. In this sense, the
window behaves as a filter,
gathering contributions for
its estimate over its band-
width [3]. Remember, to re-
duce side lobes we increase
main lobe width, which
permits more noise into the
spectral measurement and
at the same time reduces
the amplitude of the main
Fig. 8. Scalloping loss is 3.9 dB for a rectangular window and 1.2 dB for a Kaiser-Bessel window measuring a spectral lobe, which reduces the
peak at position 4.5 cycles per interval, midway between bins 4 and 5.
amplitude of the desired
sine wave measurement.
overlap of the main lobes corresponding to the nearest compo- The window reduces the signal-to-noise ratio (SNR) relative
nents. As a consequence, even if the frequency resolution of the to the SNR of the default rectangle window. A measure of how
DFT is very high, it isn’t possible to resolve near components much SNR improvement obtained from a windowed FFT can
with similar amplitude whose distance is lower than the width be found as the ratio between the SNR before and after the
of the window main lobe (Figure 7). To this aim, the width of calculation, called Processing Gain (PG):
each lobe is defined to be the frequency interval correspond-
ing to a 6-dB attenuation to the DC gain and is called minimum
Resolution Bandwidth (RBW) [3], [6]. As indicated in [3], the
minimum RBW goes from 1.2 to 2.6 bins, depending on the
specific window. (14)

Side Lobes where, So/No is the output SNR, Si/Ni is the input SNR, and w(k)
The detectability of weak components is mainly affected by is the window sample. The PG of a rectangle window is N (sum
two characteristics of the window frequency response: the squared/sum of squares), the PG of a Hann window is N/1.5
highest side lobe level and the rate of side lobe roll-off. The lev- and the PG for a 60-dB Kaiser Window is N/1.7. Usually the PG is
el of the highest side lobe is given as a ratio in dB normalized normalized to the PG of a rectangle of the same length N. Interest-
to the main lobe level. The maximum side lobe level usually ingly, the reciprocal of the PG is the equivalent noise bandwidth
falls inversely with the main lobe width. The side lobe roll-off ENBW, the width of a spectral rectangle of unit amplitude that
is usually given in terms of the frequency response decrease in passes the same noise power as the window being described.
dB per frequency octave or decade. This rate is1/f (m+1), where m Thus, the ENBW of a rectangle is 1/N and of a Hann window is
is the order of the derivative of the window envelope in which 1.5/N. The Hann window’s equivalent filter passes half again
the first discontinuity resides. For instance, a rectangle is dis- as much noise as does the rectangle window’s equivalent filter.
continuous in the zero-th derivative, and its rate of spectral Incidentally, the reduction in SNR or PG due to use of a good
decay is 1/f 1 or 6 dB/octave, and a Hann window is discon- window is exactly cancelled by the variance reduction obtained
tinuous in the second derivative and its rate of spectral decay when averaging overlapped windowed transforms [8], [9].
is 1/f 3 [1], [3]. Note that the Hann window has a discontinuity
in its zero-th derivative, and its rate of spectral decay is also Scalloping Loss
1/f, but it has lower side lobes than the rectangle because it has When the frequency being analyzed by the DFT is bin-cen-
a smaller discontinuity. Similarly, the Kaiser-Bessel window tered, the DFT sample coincides with the peak of the window’s
also has a discontinuity in its zero-th derivative, and its rate main lobe response. When the frequency is positioned offset

42 IEEE Instrumentation & Measurement Magazine December 2007


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
Display,
actuators,
Sensor Input Processing Output signals,
control

Fig. 9. Time domain and spectra of windows with −90-dB side lobes and main lobe width of Fs /N.

from the bin center, the DFT sample is offset on the main ◗ A paraphrase of the Nyquist criterion tells us that the
lobe, and the measurement is less than the peak value. The sample rate should exceed the two-sided bandwidth of
worst-case reduction in measurement value occurs when the the signal. For real baseband signals this is interpreted as
signal frequency resides midway between two bin centers. such: the sample rate must be at least twice the highest
An example would be a sine wave with 4.5 cycles per interval frequency component in the signal. This is a very restric-
of length N, its spectral peak residing midway between bins 4 tive interpretation and should not limit your options. The
and 5. Here both adjacent bins offer a reduced-level sample of transform of a real signal exhibits Hermetian symmetry,
the offset main lobe spectral response. Windows with wider H(k) = H*(−k). As such, without loss of information, the
main lobe width have smaller loss as a result of the frequency FFT can be computed and displayed for positive frequen-
offset. As seen in Figure 8, the amplitude error, called scalloping cies only. Complex signals, on the other hand, formed, for
loss, depends on the window’s main lobe bandwidth. Usually instance, by a quadrature downconversion of a span of
the scalloping loss is reported in dB and goes from 0.1 to 3.92, positive frequencies, does not exhibit spectral symmetry.
depending on the window [3]. As such, the FFT must be computed and displayed for
both positive and negative frequencies. Bear in mind that
Misconceptions the analog anti-aliasing filters have a transition band-
Common misconceptions to keep in mind when estimating the width, and not all spectral components are alias free. It is
spectrum of a signal with an FFT are the following: typical, for instance, to allow the aliased transition band
◗ The transform length N does not have to be a power of 2. to corrupt 10–20% of the spectrum so that a 1,024-point
FFTs come in all sizes, and any (non-prime) length FFT is FFT can present 400 spectral lines for real signals, or 800
available. A 500-point transform is as efficient as a 512 - lines for complex signals [2].
point transform. Transforms with lengths that are powers ◗ A number of pre- and post-processing algorithms aid
of 2 have very simple coding structure, which influences the FFT in the spectral estimation task. We discuss one
hardware implementations but has little bearing on soft- here to catch the reader’s interest. The spectral resolu-
ware-based spectral estimation. tion of an FFT is initially defined by the spacing between

December 2007 IEEE Instrumentation & Measurement Magazine 43


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.
spectral bins Fs/N. A rectangle window has a main lobe [7] F.J. Harris, Multirate Signal Processing for Communication Systems,
spectral width of F s/N, which matches this spacing. Englewood Cliffs, NJ: Prentice Hall, 2004.
When a good window is applied to the data to suppress [8] D. Elliot, “Time domain signal processing with the DFT,” Chapter
the spectral side lobes, the main lobe width increases 8 in Handbook of Digital Signal Processing; Engineering Applications,”
by a factor of 4 to 4Fs/N. This increased width reduces Orlando, FL: Academic Press, 1987.
the spectral resolution by the same factor. A response to [9] F.J. Harris, “On detecting white space spectra for spectral
this reduced resolution is to increase the data record and scavenging in cognitive radios,” in Proc. Wireless Personal
window length from N to 4N and to thus return the reso- Multimedia Communications, 2007, Jaipur, India, publication in Dec.
lution to 4Fs/(4N). This appears to also increase the FFT 2007.
length, which we don’t want to do. We keep the same- [10] F.J. Harris, “Spectral analysis windowing,” in Wiley
length FFT by computing every fourth transform point, Encyclopedia of Electrical and Electronics Engineering, vol. 20,
which matches the original spectra spacing of Fs/N. The J.G. Webster, ed., New York: John Wiley & Sons, Inc., 1999, pp.
4-to-1 spectral downsampling induces a fourfold time 88–105.
domain aliasing of the length 4N windowed signal to the [11] F.J. Harris, “On Overlapped Fast Fourier Transforms”, Int.
N length series that is processed by the N-point trans- Telemetering Conf. (ITC-78), Los Angeles, 1978, 301-306.
form. The folding of windowed signals is performed by
a pre-processor, prior to the FFT, known as a polyphase Sergio Rapuano (rapuano@
partition [7]–[10]. The combination of folded window unisannio.it) received the M.S.
and FFT is referred to as a polyphase channelizer. Figure degree in electronic engineering
9 illustrates the morphing of the window’s spectral main and the Ph.D. degree in com-
lobe width from Fs/N to 4Fs/N and then back to 4Fs/(4N) puter science, telecommunica-
and 6Fs/(6N). tions, and applied electromag-
netism from the University of
Conclusions Salerno. Since 2002, he has been
This paper includes a brief tutorial on digital spectrum analy- with the faculty of engineering
sis and FFT-related issues to form spectral estimates on digi- at the University of Sannio as
tized signals. Some review of the DFT has been presented, and an assistant professor in electric
some discussion on the computational advantages of the FFT and electronic measurement. Dr. Rapuano is a member of the
calculation has also been presented. Finally, the main consid- IEEE I&M Society TC-10 and the secretary of the TC-23 Work-
erations on windowing and window characteristics have been ing Group on “e-tools for Education in Instrumentation and
briefly discussed. Measurement.” He is currently developing his research activi-
ties in the fields of data converters, distributed measurement
References systems, and digital signal processing for measurement and
[1] A.V. Oppenheim and R.W. Schafer, “Digital Signal Processing,” medical measurements.
Englewood Cliffs, NJ: Prentice Hall, 1975.
[2] S. Rapuano, P. Daponte, E. Balestrieri, L. De Vito, S.J. Tilden, S. Fredric J. Harris (fred.harris@
Max, and J. Blair, “ADC parameters and characteristics,” IEEE sdsu.edu) is at San Diego State
Instrument. Meas. Mag., vol. 8, (no. 5), pp. 44–54, Dec 2005. University, where he teaches
[3] F. J. Harris, “On the use of Windows for harmonic analysis with courses in “Digital Signal Pro-
the Discrete Fourier Transform,” Proc. IEEE, vol. 66, (no. 1), pp. cessing and Communication
51–83, Jan 1978. Systems.” He is a fellow of the
[4] M.T. Heideman, D.H. Johnson, and C.S. Burrus, “Gauss and the IEEE and author of the text
history of the fast fourier transform”, IEEE ASSP Magazine, Vol. 1, Multirate Signal Processing for
(no.4), part.1, pp. 14-21, Oct. 1984. Communication Systems (Pren-
[5] E. Brigham, Fast Fourier Transform and Its Applications, Englewood tice-Hall). He roams the world
Cliffs, NJ: Prentice Hall, 1988. collecting old toys and slide
[6] R.A. Witte, Spectrum and Network Measurements, Englewood Cliffs, rules and riding old railways.
NJ: Prentice Hall, 1993.

44 IEEE Instrumentation & Measurement Magazine December 2007


Authorized licensed use limited to: University of Malaya. Downloaded on June 01,2023 at 13:46:52 UTC from IEEE Xplore. Restrictions apply.

You might also like