FFT - Instrumentacion

download FFT - Instrumentacion

of 13

Transcript of FFT - Instrumentacion

  • 7/29/2019 FFT - Instrumentacion

    1/13

    32 IEEE Instrumentation & Measurement Magazine December 2007

    An Introductionto FFT and Time

    Domain Windows

    Part 11 in a series of tutorials ininstrumentation and measurement

    Sergio Rapuano and Fred J. Harris

    1094-6969/07/$25.002007IEEE

    Astudent in a digital signal processing class

    once asked an insightul set o questions.

    They went something like this: Proessor,

    can you explain why we spend so much o our time

    describing signals in the requency domain? We rst ex-amined circuits in terms o their sinusoidal steady-state

    response. We then went on to study Fouri-

    er series and Fourier transorms, and

    we are now studying sampled

    data Fourier transorms, and

    the Discrete Fourier trans-

    orm, all based on sinusoids

    and sampled data sinu-

    soids. Why not use other

    basis unctions? What is so

    special about sinusoids?

    Great questions! We wish

    we had thought to ask them!

    The answers are simple.

    Many o the dynamic systems we

    analyze, synthesize, design, develop,

    and operate can be approximated by linear

    time invariant systems modeled by linear, constant-

    coecient, dierential equations. So now the question

    is, What does that mean? It means this: i we di-

    erentiate a sinusoid, it is still a sinusoid. I we orm a

    weighted sum o derivatives o a sinusoid, the sum is

    still a sinusoid. The sinusoid never stops being a sinu-

    soid. No other wave shape can make that claim! The

    sinusoids preserve their identity in a linear system; the

    system can change the sinusoids amplitude and phase

    but it cannot change its basic structure. Sinusoids are

    eigenunctions o linear, constant-coeicient, dier-ential equations. As such, the sinusoids can be used to

    analyze and characterize the linear system.

    The collection o amplitude and phase

    changes experienced by sinusoids

    o dierent requencies passing

    through the system compactly

    describes the system. We call

    this description its requency

    response. The requency re-

    sponse is intimately tied to

    the systems transer unction

    and its dierential equation.

    The Fourier transorm is also

    used to describe signals in the time

    or spatial domains. We limit our dis-

    cussion here to time domain descriptions.

    Signals o interest are decomposed into a set o

    complete orthonormal basis unctions, the real sines and

    cosines, or, equivalently, the set o complex exponentials

    [3]. The classic Fourier transorm is the mechanism that

    perorms this decomposition, leading to a requency

    domain description o the signal. There are several ad-

    vantages to analyzing signals in the requency domain.

    Sensor Input Processing Output

    Display,actuators,signals,control

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    2/13

    December 2007 IEEE Instrumentation & Measurement Magazine 33

    Probably the most evi-

    dent is the relevant in-

    crease in dynamic range

    in comparison with time

    domain methods. Frequency

    domain analysis can resolve:

    measure and detect the ampli-

    tude and phase o overlappedsignals the amplitudes o which dier

    by orders o magnitude. This powerul

    characteristic makes requency domain

    measurements important in many ields,

    including telecommunication, instrumenta-

    tion, radar, sonar, consumer entertainment, and

    other systems requiring signal analysis, signal

    detection, modulation, and demodulation.

    The Fourier theory had originally been ormu-

    lated or continuous time and amplitude signals, i.e.,

    analog signals and systems. With the advent o the digi-

    tal computer, in particular o the microprocessor, spectrumanalysis could be perormed in the digital domain along

    with many o the other signal processing tasks perormed

    by digital techniques. The sampling theorem was well es-

    tablished prior to the arrival o the digital computer, and the

    missing components required to perorm signal processing

    on sampled data signals were the transducers to pass sig-

    nals back and orth between the continuous domain and the

    sampled data domain. The need or high-perormance, low-

    cost analog-to-digital converters (ADCs) and their duals,

    the digital-to-analog converters, was recognized early on,

    and their development closely paralleled that o the micro-

    processor. It is interesting to note that the rst applicationso sampled data signal processing occurred in the sampled

    data control area because the required sample rates were

    low, as were the bandwidths o the mechanical systems being

    controlled. The next application was that o processing audio

    signals, also with a relatively low bandwidth matched to

    the then-improved perormance capabilities o early ADCs.

    This evolution is seen in the publication history, with the rst

    venue or signal processing articles being the IEEE Journal on

    Audio and Electroacoustics (1965), which morphed intoAudio,

    Speech, and Signal Processing (1984), on its way to becoming

    the Transactions on Signal Processing (1991).

    The mathematical tools were ready and waiting as the

    enabling technology and applications came together in the

    early 1960s. When digital data (the sampled and quantized

    representation o an analog signal) were delivered by ADCs to

    the digital domain, they ound a rich body o signal processing

    options ready to manipulate and extract signal parameters.

    The Z-transorm had already been developed as the sampled

    data counterpart to the Laplace transorm, and the discrete

    Fourier transorm (DFT) had been developed as a counterpart

    to the Fourier transorm (FT). One modication to the DFT was

    required to perorm machine computation o the sampled data

    spectrum. The DFT is dened as a sum over a two-sided inter-

    val rom to +. In practice we oten change the lower limit o

    the sum to 0 to acknowl-

    edge causality and to

    obtain the one-sided DFT

    as a sum rom 0 to +. The

    practical consideration is that

    we can never perorm an ini-

    nite sum in a computer. We have to

    limit the range o the sum to a niteinterval, say, 0 to N 1, a sum contain-

    ing Nterms. This little detail essentially

    turns the data collection process on at in-

    dex 0 and then turns it o at index N 1. This

    gating operation means that the sum is always

    perormed over nite data collection apertures,

    with boundary conditions equivalent to an abrupt

    turning on and o o the collected data. Turning data

    abruptly on and o has an undesired infuence on the

    spectrum o the collected signal samples. We ameliorate

    this eect using a multiplicative weighting term applied to

    the data in the collection interval, which slowly and gentlyturns the data on and o at the boundaries. This is a common

    operation in many signal processing systems acing nite ap-

    ertures. In time-series signal processing we call the weighting

    unction a window, in spatial processing (beam orming) we

    call it a shading function, and in photolithography we call it an

    apodizing function.

    The DFT is implemented in digital systems by a amily o

    algorithms collectively known as the ast Fourier transorm

    (FFT). The FFT oers a signicant reduction in computational

    workload relative to the DFT. The DFT requires on the order

    oN2 complex operations (multiplies and adds), while the

    FFT can be implemented with workloads between 2 Nandlog2(N) N/2 complex operations. Some inormation on FFT

    history can be ound in [4]. The FFT is widely applied in digital

    signal processingbased systems. [5] These include modula-

    tion and demodulation applications in telecommunication

    systems, with examples being Orthogonal Frequency Domain

    Multiplexing (OFDM) and Asymmetric Digital Subscriber

    Lines (ADSL) and measurement and instrumentation systems,

    the emphasis o this paper. Processing a nite aperture obser-

    vation introduces several arteacts into the spectral analysis

    process. One important arteact is spectral leakage, the spill-

    ing o energy centered at one requency into the surrounding

    spectral regions. This eect limits our ability to reliably detect

    low-level signal in the presence o nearby high-level signals.

    Windows are designed and applied to suppress this arteact.

    A second attribute brought to bear by the nite aperture is the

    uncertainty principle. The nite aperture limits spectral re-

    solvability, the ability to detect closely spaced similar-strength

    tones as individual signal components [3]. What we will learn

    here is that when we apply a window to the signal to control

    biases due to spectral leakage, we increase the width o the

    spectral main lobe, which causes secondary eects related to

    spectral resolution (separating nearby signals), processing

    gain (separating signals rom noise), and window overlap (sat-

    isying Nyquist). We will examine and highlight these eects.

    What is so special about

    sinusoids?The sinusoid

    never stops being a

    sinusoid. No other

    waveshape can

    make that

    claim!

    S en so r I np ut Processing Output

    Display,actuators,signals,control

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    3/13

    34 IEEE Instrumentation & Measurement Magazine December 2007

    The paper is intended to give the basic elements o FFT-

    based spectrum analysis, starting with the properties o the

    DFT and introducing considerations related to its ast imple-

    mentation. We examine the deault window, the rectangle,

    and its contribution to spectral leakage, as well as designed

    windows and how they can be used to obtain accurate spec-

    tral estimates. Finally, we discuss and compare the main

    characteristics o the windows used in spectrum and networkmeasurements along with inormation on their secondary

    attributes.

    The Discrete Fourier TransormThe mathematic tool or analyzing signals and systems

    in the requency domain is the FT. When applied to a real

    or complex valued analog signal xa(t), it produces its as-

    sociated requency domain representation, Xa(f), called its

    spectrum. The basic idea behind spectrum analysis is that,

    subject to easy-to-satisy restrictions, a signal can be ormed

    as a weighted sum o complex exponential unctions (called

    spectral components). The weighting terms at each requencyare the complex amplitude and phase. Spectral analysis is the

    process by which we estimate the amplitude and phase o the

    components located at each requency. For this reason, Xa(f)

    is a complex signal, the magnitude o which represents the

    sinusoids amplitudes versus requency, which we denote

    the magnitude spectrum oxa(t), and whose phase represents

    the sinusoid phases versus requency, which we denote the

    phase spectrum oxa(t).

    An aperiodic signal has requency domain representation

    dened by the FT integral shown in Equation 1, as ollows:

    (1)

    with an inverse transorm integral as shown in Equation 2:

    (2)

    When xa(t)is periodic in T0s, the spectral components are

    harmonics located at multiples o the undamental requency,

    1/T0Hz. The signal xa(t) can be represented, in the mean square

    sense, with a countable sum o sine waves by the Fourier Series

    (FS) [1] integral shown in Equation 3. The resulting magnitude

    and phase spectra reside only at the integer multiples o the

    requency 1/T0, or k/T0.

    (3)

    with an inverse transorm sum as shown in Equation 4:

    (4)

    Note that within a scale actor, the FS (Equation 3) o a

    periodic signal is a sampled FT (Equation 1) o a single cycle

    o the periodic signal, as is shown in Equation 5. What we

    realize here is that sampling in the requency domain induces

    periodicity in the time domain. The converse, o course, is also

    true: sampling in the time domain induces periodicity in the

    requency domain and results in the sampled data Fourier

    transorm (SDFT):

    (5)

    The FT and the FS are applicable to analog signals. That

    means that FT and FS describe continuous time signals and

    have continuous and discrete spectra, respectively, with

    arbitrary amplitude and phase proiles. All mathematics

    associated with the Fourier theory is applicable to digital sys-

    tems. The SDFT is dened or sequences o arbitrary length

    and is the counterpart o the inverse FS. By the application o

    appropriate windows, the SDFT can process nite length se-

    quences. The SDFT is shown in Equation 6. Here the variable is digital requency with units o radians/sample, bounded

    by the interval p

  • 7/29/2019 FFT - Instrumentacion

    4/13

    December 2007 IEEE Instrumentation & Measurement Magazine 35

    (9)

    The inverse DFT, which is the nite sum replacement o

    Equation 8, is shown in Equation 10.

    (10)

    An important observation is that X(k)is a periodic set o

    requency samples due to the original time domain sampling

    process. The positive requencies are located at indices 0 k

    N/2, and since index Nis congruent to index 0, the negative

    requencies 1 k N/2 are located at N 1 kN/2.Simi-

    larly, x(n) has become a periodic set o time domain samples,

    periodic in Nsamples, due to the sampling o the spectral

    unction.Note that quantization o sampled data sequence has no

    bearing on the properties o the SDFT. The quantization noise

    can be attributed to source coding noise and is treated as addi-

    tive noise, which is seen as one o the noise terms in the spectra

    when the spectra is computed by nite precision arithmetic

    processors.

    Summarizing this section, we can say that

    Sampling an analog signal at requency FS induces peri-

    odicity o its spectrum with period FS or with normalized

    period 2p.

    The DFT orms equally spaced samples o the periodic

    sampled data spectrum.Sampling the periodic spectrum o the input sequence

    at multiples oFS/Ninduces periodicity o the input se-

    quence with period N.

    The samples in the requency domain are equally spaced

    at multiples oFS/N; thereore, spectral values dier-

    ent rom kFS/Nare not available rom the N-length

    transorm. The requency interval FS/Ndenes the

    transormfrequency resolution, and the requencies

    kFS/Nare denotedfrequency bins.

    Additional requency resolution can be

    obtained or a sequence o length N by

    perorming a 2Nor 4N-point transorm

    on the zero-extended versions o the

    sequence.

    Applications o the DFTBy using the DFT and its properties, it

    is possible to do the ollowing:

    Compute the spectrum o a

    sampled data signal.

    Perorm circular con-

    volution o two sam-

    pled signals as the

    N-point IDFT o

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

    sequences may have to be zero extended to length N.

    Perorm linear convolution o two sampled signals as the

    2N-point IDFT o the spectral product o their 2N-point

    DFTs. Both N-point sequences must be zero extended to

    length 2N.

    Determine the requency response o a sampled data

    system as the ratio o the N-point DFTs o the windowedoutput and input series.

    Synthesize the time-domain sampled waveorm rom its

    requency domain representation.

    The main advantage o the DFT over the FT is that it permits

    machine computation o spectra.

    The DFT is a vector process, converting input time vectors

    o length Ninto output requency vectors o length N. One

    matter o concern in applying the DFT is the high computa-

    tional burden oN2 complex operations to convert the input

    vector to the output vector. A second matter o concern is that

    the spectral sampling inherent in the DFT describes the peri-

    odic extension o the input signal, which may produce spectralarteacts as a result o the articial boundaries.

    The rst concern has been put to rest by the development o

    ecient FFT algorithms, which require signicantly reduced

    computational resources to perorm the transorm. The second

    concern is handily addressed by the use o windows to sup-

    press the boundary conditions, which in turns suppresses the

    spectral leakage arteacts.

    Efcient Calculation o DFT,the FFT AlgorithmThe DFT is seen to be a set o projections o the input time

    series onto the basis vectors WnkN, where WN is the Nth root ounity, . The projections are perormed as N-point inner

    products, with each projection requiring Ncomplex multiply

    and add operations. Thus, N2 complex multiplications are re-

    quired or the direct computation o the DFT. FFT algorithms

    exist or any composite length NDFT. By composite we mean

    Nis actorable into a product o actors: i.e., N= N1 N2. For

    instance, consider the actors oN= 800 with one possible

    actoring o 32 and 25.

    Many FFT algorithms operate by the divide-and-

    conquer method. In this process, the transorm is

    partitioned into a sequence o reduced-length

    transorms that are collectively perormed with

    reduced workload. For instance, a data vector

    o length N= N1 N2 is mapped to a two-di-

    mensional intermediate array o dimen-

    sion N1-rows by N2-columns. We per-

    orm a two-dimensional transorm

    by N1 transorms over the row vec-

    tors o length N2, which requires

    N1N22 operations ollowed by

    N2transorms over the col-

    umn vectors o length N1,

    which requires N2

    N1

    2

    operations. Depend-

    Themain

    advantage

    o the DFT

    over the FT is that

    it permits machine

    computation o spectra.

    S en so r I np ut Processing Output

    Display,actuators,signals,control

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    5/13

    36 IEEE Instrumentation & Measurement Magazine December 2007

    ing on the details o the one-dimensional to two-dimensional

    mapping, there may be a set o phase rotations, called twiddle

    actors, applied to the output o the rst set o transorms prior

    to application o the second set. The total workload or the

    two-dimensional transorm is seen to be N1N22 + N2N1

    2 = (N1N2)

    (N1 + N2), which, simply stated, is the sum o the actors times

    the product o the actors. The workload or the original, un-

    actored DFT is N2 = (N1N2)(N1N2). The ratio o the workloads

    is seen to be the sum o the actors divided by the product o

    the actors, R = [(N1N2)(N1 + N2)/(N1N2)(N1N2)] or R = (N1 +

    N2)/(N1N2). With the actors or N= 1,000 o 32 and 25, this

    ratio is seen to be (32 + 25)/(32 25) = 0.071. Here we see that

    the actored orm requires only 7.1% o the workload o the

    unactored orm, a savings o nearly 93%. The actoring pro-

    cess is nested, with the 25-point transorms perormed as two-

    dimensional transorms over 5-by-5 arrays and the 32-point

    transorms perormed as 2-D transorms over 4 8 arrays.

    A common-length FFT is known as the radix-2 DFT, which

    perorms successive halving o the length NDFT, with Nbeing

    a power o 2, such as 210 = 1,024. The partition described above

    starts with a two-dimensional array o length N/2 by 2, which

    results in a savings ratio o (512 + 2)/(512 2) = 0.502, a sav-

    ings o nearly 50%. Each successive iterated partition results

    in successive 50% workload savings. The radix-2 transorm

    requires twiddle actors between successive partitions. The

    iterative partitioning operation can be repeated until the proc-

    ess perorms 512 two-point transorms, which are combined to

    obtain 256 our-point transorms, which in turn are combined

    to obtain 128 eight-point transorms, continuing until two

    512-point transorms are combined to orm the 1,024-point

    transorm [1]. Each successive combining operation requires

    N/2 complex multiplications. The number o combining steps

    is equal to the number o times the array length can be parti-

    tioned 1 to 2 (or halved), which is log2(N). Consequently, the

    total number o complex multiplications required to calculate

    a radix-2 FFT is N/2 log2(N).

    To give an idea o the computational eciency o the FFT

    algorithm over the direct DFT calculation, consider the DFT

    o length 1,024. The savings ratio is [N/2 log2(N)]/[N2] or

    log2(N)/(2N) = 10/2,048 or 0.0049, a savings o 99.5%. The

    actual numbers are 5,120 operations or the FFT, compared to

    1,048,576 operations or the direct DFT computation.

    The output o an FFT is a vector o length N, obtained by

    sampling the periodic spectrum o the sampled data signal at

    the requencies kFs

    /N. It is common to call these spectral lo-

    cationsfrequency bins. The periodic spectrum is visualized on

    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.

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    6/13

    December 2007 IEEE Instrumentation & Measurement Magazine 37

    a circle o circumerence Fs or in normalized units o 2pf/Fs. As

    we unwrap the circle to map it to a line, we traditionally cut

    the circle at angle 0 so that the line extends over the interval

    [0 to 2p), closed on the let, open on the right. The spectrum

    obtained by this cut has requency 0 at the ar let, positive

    requencies extending to the right until the mid-point, at

    which point we have the hal sample rate, beyond which we

    have the negative requencies. The FFT computes samples o

    the spectrum at increments o 2p/N, indexing the samples

    rom 0 to N 1. Sample Nis congruent to sample 0 and is, in

    act, the start o the next spectral period. Thus, sample kis

    the same as sample N kand the requencies with negative

    index; the negative requencies are located in the second hal

    o the interval. It is common in spectral displays to redene

    the cut on the circle to be located at angle p to redene the

    interval as (pto p). In this orm the center o the display is 0

    requency, with negative requencies located to the let and

    positive requencies located to the right. MATLAB uses the

    command fftshift to redene the spectral cut. The result o

    FFT calculation is a double-sided spectrum mapped to the

    requency bins rom 0to N 1. In the redened spectral cut

    the indices are mapped to N/2to +N/2 1,or in normal-

    ized coordinates, (0.5 to +0.5). For complex signals the DFT

    is asymmetrical and the entire span (0.5 to +0.5) is pre-

    sented, and or real input signals, the DFT is Hermetian sym-

    metric, so a reduced span o (0 to +0.5) is presented, since the

    positive requencies, the rst N/2 + 1samples, are sucient

    to represent the signal spectrum. Figure 1 presents the log

    magnitude spectrum ormed by an FFT o a complex and o a

    real 1.7 kHz sine wave with AWGN (Additive White Gauss-

    ian Noise) sampled at 10 kHz. Here we see the spectra with

    and without the redened spectral cuts. As can be seen, the

    spectrum o the complex signal is asymmetric and the spec-

    trum o the real signal is symmetric about both Fs/2 and 0.

    Spectral LeakageAs described earlier, the DFT computes samples o the pe-

    riodic spectrum X(q) associated with the N-point sampled

    data sequence {x(n)}. Sampling in the time domain causes

    replication (or periodic extension) o the spectrum, with rep-

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

    S en so r I np ut Processing Output

    Display,actuators,signals,control

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    7/13

    38 IEEE Instrumentation & Measurement Magazine December 2007

    licas positioned at multiples o1/T, the reciprocal o spacing

    between time samples (T=1/Fs). Similarly, sampling in the

    requency domain causes replication (or periodic extension)

    o the time series, with replicas positioned at multiples oNT,

    the reciprocal o the spacing between the requency samples

    (Fs/N=1/NT). This property can be illustrated by computing

    the N-point DFT o a sampled sequence that contains an inte-

    ger number o cycles in the sequence o length N. A complexsinusoidal sequence containing an integer number o cycles in

    Nsamples is dened in Equation 11.

    (11)

    For this sequence the periodic extension o the N-sample se-

    quence is the same as the samples obtained by sampling theoriginal sinusoid, the original signal. The DFT o the sequence

    has a non-zero spectral component at index k(or kcycles per

    interval), indicating a single sinusoid in the time series.

    The innite extent sinusoid has a FS at a single requency

    k/(NT). By including distribution unctions in the FT, we rep-

    resent the spectrum o a complex sine wave by a delta unction

    (f k/NT). When the complex sinusoid is time limited to a

    nite support o length NTseconds, its spectrum is modied.

    The altered spectrum is obtained by convolving the transorm

    o the innite extent version, (f k/NT), with the transorm othe truncating unction, WR(f), dened as ollows:

    (12)

    This unction is called rectangular window o length NT,

    and its FT WR(f) is the ubiquitous unction sin(pt/NT)/(pt/

    NT), commonly denoted sinc(t/NT) [1]. Figure 2 shows a

    segment o the input sinusoid xa(t), the window wR(t), and

    the windowed signal xa(t) WR(t), as well as their spectra

    Xa(f), WR(f), and Xa(f)*WR(f), where the symbol * denotes a

    convolution.The same results will be observed in the sample data

    domain. The process o acquiring a inite-length record o

    a signal can be modeled as

    sampling and analog-to-digi-

    tal conversion o an ininite

    number o samples ollowed

    by the multiplication o the re-

    sulting innite sequence {x(n)}

    by a discrete window unction

    {w(n)}, the values o which are

    non-zero within a speciied

    span oNsamples. I, in theexample considered above, the

    sampling period T=1/Fs and

    the acquisition time interval Ts,

    and the signal period, T0, are

    chosen to satisy the relation

    (13)

    the FFT will have the appear-

    ance shown in Figure 3. In this

    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 o the sine wave to col-

    lect a total o N = 60 samples.

    The FFT values will be zero

    or all requency bins except

    or the one corresponding to 2

    kHz, because a sample is taken

    at the peak o the main lobe o

    Xa(f) *WR(f), while all the othersFig. 3. Top: sampled and windowed 2 kHz sine wave; middle: mid: single-sided spectrum of signal; bottom: DFTsamples of sampled sine wave.

    (a)

    (b)

    (c)

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    8/13

    December 2007 IEEE Instrumentation & Measurement Magazine 39

    are taken at the zeros o the same

    spectrum. Note that in this case,

    with the sinusoid containing

    an integer number o cycles per

    interval, there is no uncertainty

    in estimating the sine wave re-

    quency and amplitude.

    Almost assuredly, we will notsee signals in which all the spec-

    tral components have an integer

    number o cycles per interval o

    lengthN. More likely, the periods

    T0are arbitrary and unknown

    and there isnt an integer kthat

    satises the condition (Equation

    11) or a given Nand a selected

    sampling period T. In these cases

    the requency components cor-

    responding to the FFT bins will

    not correctly represent the am-plitude and spectral position o

    the underlying spectral peaks

    and urther will observe the side

    lobe spectral terms related to the

    oset spectral peaks, which spill

    spectral components over all the

    requency bins.

    For example, let us consider

    the case o the sine wave xa(t)and

    suppose that T0is not known.

    Let us suppose that NT = 6.5 T0,

    as shown in Figure 4. The peri-odically extended version o this

    sequence will have a discontinu-

    ity at each Nsample not present in the original non-windowed

    sequence. The FT o this sequence is the same shited sinc

    unction as in the previous example, but the zero crossings no

    longer correspond to the DFT sample positions. Consequently,

    the DFT will now compute samples o the side lobe rather than

    samples o the zero crossings. This phenomenon is called spec-

    tral leakage. As with the continuous FT, the original spectrum is

    the convolution oXa(f) and WR(f), with the sample positions

    xed but the zero crossings translated with the center o

    the sinc. Note that the sample values in the main lobe do

    not coincide with the peak o the main lobe. Using this

    result to estimate the signal parameters will lead to

    an error in requency and amplitude. A typical peak

    detection algorithm will nd a sine wave with

    requency 2 kHz and magnitude 0.35, instead

    o 1.1 kHz and 0.50, respectively.

    The errors in measuring the signal re-

    quency and amplitude are related to the

    requency resolution and the main lobe

    width. I the signal is composed o

    many requency components with

    wide variation in amplitudes,

    the spectra o the high-level signals could mask or cover

    the spectra o the low-level components with its side lobes.

    Closely spaced spectral components may have overlapping

    main lobes, which may reduce our ability to resolve them as

    separate components.

    Spectral leakage o window spectral side lobes is respon-

    sible or (i) errors in estimating the requency and amplitude

    o the requency components rom the FFT bins and (ii) a

    limitation o system dynamic range as a result o the mask-

    ing aect o strong components on weak components.

    Spectral width o the windows spectral main lobe is

    responsible or the minimum separation required

    between two requency components o similar

    amplitude to assure reliable detection o distinct

    signal components. This separation, called

    minimum resolution bandwidth, also reduces

    the capability o detecting weak requency

    components near strong components.

    Spectral leakage cannot be avoided

    when the signal components are un-

    known. Proper design trades be-

    tween spectral resolvability and

    Fig. 4. Top: sampled and windowed 2.2-kHz sine wave; middle, single-sided spectrum of signal; bottom: DFT

    samples of sampled sine wave. Note samples of spectral side lobes.

    (a)

    (b)

    (c)

    Acommon-

    length FFT

    is known as the

    radix-2 DFT.

    S en so r I np ut Processing Output

    Display,actuators,signals,control

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    9/13

    40 IEEE Instrumentation & Measurement Magazine December 2007

    detection capability are required to reduce errors in amplitude

    and requency estimates.

    WindowsInstead o the rectangular window, other window unctions

    are generally adopted to control the limitations listed above.

    All well-designed windows have the characteristic o going

    gently and smoothly to near-zero values at the boundaries

    o their support intervals. Consequently, the discontinuities

    at the boundaries o the periodically extended sequence are

    suppressed as the amplitudes and many order derivatives

    are matched at the boundaries. As illustrated in Figure 5, the

    window modies the input signal by smoothly and gently

    bringing the signal envelope to near-zero values at the bound-

    aries o the acquisition interval. The result will be a controlled

    insertion o leakage.

    Examining the DFT samples shown in Figure 5 we see that

    the samples ar removed rom the main lobe are quite small

    and will reduce the masking eects due to high side lobes. We

    also see the multiple samples o the main lobe, which reduces

    our ability to estimate the center requency and amplitude o

    the sine wave. The known

    bias in amplitude due to the

    reduced-amplitude main

    lobe o the Hann window

    relative to the rectangle

    window is easily removed.

    The amplitude o each win-

    dow is simply the sum othe window coeicients

    and can be properly scaled

    out ater the measurement.

    The residual amplitude er-

    ror resulting rom position

    o the center lobe relative to

    the DFT xed 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 o the parabola.

    This works amazingly well

    because in log amplitude,

    all spectral windows are

    approximately parabolas.To reiterate, we comment

    that good windows reduce

    the side lobe levels, thus

    improving the detectability o weak requency components,

    and the errors made by estimating each component requency

    and amplitude can be easily eliminated by polynomial in-

    terpolation. An alternate interpolation option is obtained by

    simply zero extending the length-Nwindowed time series to

    length 2Nor 4Nand perorming the increased length DFT.

    In Figure 6, we show examples o the time and requency re-

    sponses o windows most oten used in digital spectrum analysis

    [1], [6]. The choice o the window may vary or a specic applica-

    tion, as each has dierent eects on the FFT output. Generally, a

    window with a very narrow main lobe will have a high spectral

    resolvability and a lower uncertainty in measuring the requency

    o a spectral component. In most cases, a narrow main lobe implies

    high side lobes causing low detectability o weak spectral compo-

    nents. In addition, a narrow main lobe will cause a commensu-

    rate uncertainty in the measurement o the spectral component

    amplitudes as a result o high scallop loss. For example, the Hann

    window is the window o choice in applications requiring high

    resolvability. As a result o its narrow main lobe, the requency

    resolution is maximized and the requency measurement uncer-

    tainty is minimized. However, because o the higher side lobes,

    Fig. 5. Effects of the Hann window. Top: windowed sine wave; middle: single-sided spectrum of windowed signal; bottom:DFT samples of windowed and sampled sine wave.

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    10/13

    December 2007 IEEE Instrumentation & Measurement Magazine 41

    the detectability o low-level nearby spectral terms is reduced in

    comparison with other windows. The uncertainty o the ampli-

    tude measurement is greater than or windows designed or low

    scallop loss, such as the harris Flat Top window. As a result o the

    wide fat spectral response, the Flat Top has small scallop loss and

    hence exhibits small amplitude errors, but the same fatness leads

    to signicant requency uncertainty, which must be resolved by

    one o the spectral interpolation options.

    The Flat Top window, on the other hand, has a fat but very

    wide main lobe and lower side lobes. The Kaiser-Bessel win-

    dow, with a time-bandwidth parameter, , oers a selectable

    trade between side lobe levels and main lobe width. Some

    digital signal processing systems oer the option to select a

    window rom a set to give the user more degrees o reedom

    in the analysis. In all cases the user should be aware o the e-

    ect o the windows on the measurement results. A complete

    introduction to the windowing techniques as well as a review

    o more window characteristics can be ound in [3].

    Windows CharacterizationThere are several gures o merit used or classiying the win-

    dows used in digital spectrum analysis. All parameters reer to

    characteristics o the window requency response. In [3], [7], and

    [8], a complete description o them is given in mathematical and

    practical terms. Here some parameters are recalled and briefy

    introduced in order to give some indications on how to interpret

    them or nding the right trade-o or a given application.

    Minimum Resolution Bandwidth

    As described above, as a result o the convolution o the sig-

    nal and the window spectra, the windowed signal spectrum

    includes a replica o the window requency response located

    at each requency component o the signal, resulting in an

    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.

    Fig. 7. Overlapped components that cannot be distinguished (one peak) andthat can be distinguished (two peaks) [3].

    S en so r I np ut Processing Output

    Display,actuators,signals,control

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    11/13

    42 IEEE Instrumentation & Measurement Magazine December 2007

    overlap o the main lobes corresponding to the nearest compo-

    nents. As a consequence, even i the requency resolution o the

    DFT is very high, it isnt possible to resolve near components

    with similar amplitude whose distance is lower than the width

    o the window main lobe (Figure 7). To this aim, the width o

    each lobe is dened to be the requency 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 rom 1.2 to 2.6 bins, depending on the

    specic window.

    Side Lobes

    The detectability o weak components is mainly aected by

    two characteristics o the window requency response: the

    highest side lobe level and the rate o side lobe roll-o. The lev-

    el o the highest side lobe is given as a ratio in dB normalized

    to the main lobe level. The maximum side lobe level usually

    alls inversely with the main lobe width. The side lobe roll-o

    is usually given in terms o the requency response decrease in

    dB per requency octave or decade. This rate is1/f(m+1),where m

    is the order o the derivative o the window envelope in which

    the rst discontinuity resides. For instance, a rectangle is dis-

    continuous in the zero-th derivative, and its rate o spectral

    decay is 1/f1 or 6 dB/octave, and a Hann window is discon-

    tinuous in the second derivative and its rate o spectral decay

    is 1/f3 [1], [3]. Note that the Hann window has a discontinuity

    in its zero-th derivative, and its rate o spectral decay is also

    1/f, but it has lower side lobes than the rectangle because it has

    a smaller discontinuity. Similarly, the Kaiser-Bessel window

    also has a discontinuity in its zero-th derivative, and its rate

    o spectral decay is also

    1/fbut has even lower side

    lobes because o its even-

    smaller discontinuity.

    Processing Gain/Processing

    Loss

    The amplitude estimationo a requency component

    is aected by the broad-

    band noise passed by the

    bandwidth o its spectral

    main lobe. In this sense, the

    window behaves as a lter,

    gathering contributions or

    its estimate over its band-

    width [3]. Remember, to re-

    duce side lobes we increase

    main lobe width, which

    permits more noise into thespectral measurement and

    at the same time reduces

    the amplitude o the main

    lobe, which reduces the

    amplitude o the desired

    sine wave measurement.

    The window reduces the signal-to-noise ratio (SNR) relative

    to the SNR o the deault rectangle window. A measure o how

    much SNR improvement obtained rom a windowed FFT can

    be ound as the ratio between the SNR beore and ater the

    calculation, called Processing Gain (PG):

    (14)

    where, So/No is the output SNR, Si/Ni is the input SNR, and w(k)

    is the window sample. The PG o a rectangle window is N(sum

    squared/sum o squares), the PG o a Hann window is N/1.5

    and thePGor a 60-dB Kaiser Window is N/1.7. Usually thePG is

    normalized to thePGo a rectangle o the same lengthN. Interest-

    ingly, the reciprocal o the PG is the equivalent noise bandwidth

    ENBW, the width o a spectral rectangle o unit amplitude that

    passes the same noise power as the window being described.

    Thus, the ENBWo a rectangle is 1/Nand o a Hann window is

    1.5/N. The Hann windows equivalent lter passes hal again

    as much noise as does the rectangle windows equivalent lter.

    Incidentally, the reduction in SNR or PG due to use o a good

    window is exactly cancelled by the variance reduction obtained

    when averaging overlapped windowed transorms [8], [9].

    Scalloping Loss

    When the requency being analyzed by the DFT is bin-cen-

    tered, the DFT sample coincides with the peak o the windows

    main lobe response. When the requency is positioned oset

    Fig. 8. Scalloping loss is 3.9 dB for a rectangular window and 1.2 dB for a Kaiser-Bessel window measuring a spectralpeak at position 4.5 cycles per interval, midway between bins 4 and 5.

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    12/13

    December 2007 IEEE Instrumentation & Measurement Magazine 43

    rom the bin center, the DFT sample is oset on the main

    lobe, and the measurement is less than the peak value. The

    worst-case reduction in measurement value occurs when the

    signal requency resides midway between two bin centers.

    An example would be a sine wave with 4.5 cycles per interval

    o length N, its spectral peak residing midway between bins 4

    and 5. Here both adjacent bins oer a reduced-level sample o

    the oset main lobe spectral response. Windows with wider

    main lobe width have smaller loss as a result o the requency

    oset. As seen in Figure 8, the amplitude error, called scalloping

    loss, depends on the windows main lobe bandwidth. Usually

    the scalloping loss is reported in dB and goes rom 0.1 to 3.92,

    depending on the window [3].

    Misconceptions

    Common misconceptions to keep in mind when estimating the

    spectrum o a signal with an FFT are the ollowing:

    The transorm length Ndoes not have to be a power o 2.

    FFTs come in all sizes, and any (non-prime) length FFT is

    available. A 500-point transorm is as ecient as a 512 -

    point transorm. Transorms with lengths that are powers

    o 2 have very simple coding structure, which infuences

    hardware implementations but has little bearing on sot-

    ware-based spectral estimation.

    A paraphrase o the Nyquist criterion tells us that the

    sample rate should exceed the two-sided bandwidth o

    the signal. For real baseband signals this is interpreted as

    such: the sample rate must be at least twice the highest

    requency component in the signal. This is a very restric-

    tive interpretation and should not limit your options. The

    transorm o a real signal exhibits Hermetian symmetry,

    H(k) = H*(k). As such, without loss o inormation, the

    FFT can be computed and displayed or positive requen-

    cies only. Complex signals, on the other hand, ormed, or

    instance, by a quadrature downconversion o a span o

    positive requencies, does not exhibit spectral symmetry.

    As such, the FFT must be computed and displayed or

    both positive and negative requencies. Bear in mind that

    the analog anti-aliasing lters have a transition band-

    width, and not all spectral components are alias ree. It is

    typical, or instance, to allow the aliased transition band

    to corrupt 1020% o the spectrum so that a 1,024-point

    FFT can present 400 spectral lines or real signals, or 800

    lines or complex signals [2].

    A number o pre- and post-processing algorithms aid

    the FFT in the spectral estimation task. We discuss one

    here to catch the readers interest. The spectral resolu-

    tion o an FFT is initially dened by the spacing between

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

    S en so r I np ut Processing Output

    Display,actuators,signals,control

    Authorized licensed use limited to: Centro de Investigacion Tec de las Fuerzas Armadas. Downloaded on November 2, 2009 at 11:03 from IEEE Xplore. Restrictions apply.

  • 7/29/2019 FFT - Instrumentacion

    13/13

    44 IEEE Instrumentation & Measurement Magazine December 2007

    spectral bins Fs/N. A rectangle window has a main lobe

    spectral width oFs/N, which matches this spacing.

    When a good window is applied to the data to suppress

    the spectral side lobes, the main lobe width increases

    by a actor o 4 to 4Fs/N. This increased width reduces

    the spectral resolution by the same actor. A response to

    this reduced resolution is to increase the data record and

    window length rom Nto 4Nand to thus return the reso-lution to 4Fs/(4N).This appears to also increase the FFT

    length, which we dont want to do. We keep the same-

    length FFT by computing every ourth transorm point,

    which matches the original spectra spacing oFs/N. The

    4-to-1 spectral downsampling induces a ourold time

    domain aliasing o the length 4Nwindowed signal to the

    Nlength series that is processed by the N-point trans-

    orm. The olding o windowed signals is perormed by

    a pre-processor, prior to the FFT, known as a polyphase

    partition [7][10]. The combination o olded window

    and FFT is reerred to as a polyphase channelizer. Figure

    9 illustrates the morphing o the windows spectral mainlobe width rom Fs/Nto 4Fs/Nand then back to 4Fs/(4N)

    and6Fs/(6N).

    ConclusionsThis paper includes a brie tutorial on digital spectrum analy-

    sis and FFT-related issues to orm spectral estimates on digi-

    tized signals. Some review o the DFT has been presented, and

    some discussion on the computational advantages o the FFT

    calculation has also been presented. Finally, the main consid-

    erations on windowing and window characteristics have been

    briefy discussed.

    Reerences[1] A.V. Oppenheim and R.W. Schaer, Digital Signal Processing,

    Englewood Clis, NJ: Prentice Hall, 1975.

    [2] S. Rapuano, P. Daponte, E. Balestrieri, L. De Vito, S.J. Tilden, S.

    Max, and J. Blair, ADC parameters and characteristics, IEEE

    Instrument. Meas. Mag., vol. 8, (no. 5), pp. 4454, Dec 2005.

    [3] F. J. Harris, On the use o Windows or harmonic analysis with

    the Discrete Fourier Transorm, Proc. IEEE, vol. 66, (no. 1), pp.

    5183, Jan 1978.

    [4] M.T. Heideman, D.H. Johnson, and C.S. Burrus, Gauss and the

    history o the ast ourier transorm, IEEE ASSP Magazine, Vol. 1,

    (no.4), part.1, pp. 14-21, Oct. 1984.

    [5] E. Brigham, Fast Fourier Transform and Its Applications, Englewood

    Clis, NJ: Prentice Hall, 1988.

    [6] R.A. Witte, Spectrum and Network Measurements, Englewood Clis,

    NJ: Prentice Hall, 1993.

    [7] F.J. Harris,Multirate Signal Processing for Communication Systems,

    Englewood Clis, NJ: Prentice Hall, 2004.

    [8] D. Elliot, Time domain signal processing with the DFT, Chapter

    8 inHandbook of Digital Signal Processing; Engineering Applications,

    Orlando, FL: Academic Press, 1987.

    [9] F.J. Harris, On detecting white space spectra or spectral

    scavenging in cognitive radios, in Proc. Wireless Personal

    Multimedia Communications, 2007, Jaipur, India, publication in Dec.2007.

    [10] F.J. Harris, Spectral analysis windowing, in Wiley

    Encyclopedia of Electrical and Electronics Engineering, vol. 20,

    J.G. Webster, ed., New York: John Wiley & Sons, Inc., 1999, pp.

    88105.

    [11] F.J. Harris, On Overlapped Fast Fourier Transorms, Int.

    Telemetering Con. (ITC-78), Los Angeles, 1978, 301-306.

    Sergio Rapuano (rapuano@

    unisannio.it) received the M.S.

    degree in electronic engineering

    and the Ph.D. degree in com-puter science, telecommunica-

    tions, and applied electromag-

    netism rom the University o

    Salerno. Since 2002, he has been

    with the aculty o engineering

    at the University o Sannio as

    an assistant proessor in electric

    and electronic measurement. Dr. Rapuano is a member o the

    IEEE I&M Society TC-10 and the secretary o the TC-23 Work-

    ing Group on e-tools or Education in Instrumentation and

    Measurement. He is currently developing his research activi-

    ties in the elds o data converters, distributed measurementsystems, and digital signal processing or measurement and

    medical measurements.

    Fredric J. Harris (red.harris@

    sdsu.edu) is at San Diego State

    University, where he teaches

    courses in Digital Signal Pro-

    cessing and Communication

    Systems. He is a ellow o the

    IEEE and author o the text

    Multirate Signal Processing for

    Communication Systems (Pren-

    tice-Hall). He roams the world

    collecting old toys and slide

    rules and riding old railways.