fast frequency and response measurements using ffts

Upload: snowjazz

Post on 30-May-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    1/33

    www.natinst.comwww.natinst.com

    Fast Frequency and Response

    Measurements using FFTs

    Fast Frequency and Response

    Measurements using FFTs

    Alain Moriat,

    Senior ArchitectFri. 12:45p

    Pecan (9B)

    Alain Moriat,

    Senior ArchitectFri. 12:45p

    Pecan (9B)

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    2/33

    www.natinst.comwww.natinst.com

    Accurately Detect a ToneAccurately Detect a Tone

    What is the exact frequency and amplitude of

    a tone embedded in a complex signal?

    How fast can I perform these measurements?

    How accurate are the results?

    What is the exact frequency and amplitude of

    a tone embedded in a complex signal?

    How fast can I perform these measurements?

    How accurate are the results?

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    3/33

    www.natinst.comwww.natinst.com

    Presentation OverviewPresentation Overview

    Why use the frequency domain?

    FFT a short introduction

    Frequency interpolation

    Improvements using windowing

    Error evaluation

    Amplitude/phase response measurements Demos

    Why use the frequency domain?

    FFT a short introduction

    Frequency interpolation

    Improvements using windowing

    Error evaluation

    Amplitude/phase response measurements Demos

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    4/33

    www.natinst.comwww.natinst.com

    Clean Single Tone MeasurementClean Single Tone Measurement

    Clean sine tone Easy to measure

    Clean sine tone Easy to measure

    Clean tone spectrum

    Clean tone spectrum

    2

    -2

    -1

    0

    1

    1.00.0 0.2 0.4 0.6 0.8

    Time signal 20

    -60

    -40

    -20

    0

    500 5 10 15 20 25 30 35 40 45

    FFT SpectrumVolt

    mskHz

    dBV

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    5/33

    www.natinst.comwww.natinst.com

    2

    -2

    -1

    0

    1

    1.00.0 0.2 0.4 0.6 0.8

    Time signal 20

    -60

    -40

    -20

    0

    500 5 10 15 20 25 30 35 40 45

    FFT SpectrumVolt

    mskHz

    dBV

    Noisy Tone MeasurementNoisy Tone Measurement

    Noisy signal Difficult to measure in

    the time domain

    Noisy signal Difficult to measure in

    the time domain

    Noisy signal spectrum Easier to measure

    Noisy signal spectrum Easier to measure

    Our signal

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    6/33

    www.natinst.comwww.natinst.com

    Fast Fourier Transform (FFT)

    Fundamentals (Ideal Case)

    Fast Fourier Transform (FFT)

    Fundamentals (Ideal Case)

    The tone frequency is an exact multiple of the frequencyresolution (hits a bin)

    The tone frequency is an exact multiple of the frequencyresolution (hits a bin)

    2

    -2

    -1

    0

    1

    0.50.0 0.1 0.2 0.3 0.4

    Time signal 20

    -60

    -40

    -20

    0

    500 5 10 15 20 25 30 35 40 45

    FFT SpectrumVolt

    ms

    kHz

    dBV

    Fsampling = 100 kHz Record size = 50 samples

    Time res = 10 us Freq. res = 2 kHz

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    7/33

    www.natinst.comwww.natinst.com

    FFT Fundamentals (Realistic Case)FFT Fundamentals (Realistic Case)

    The tone frequency is not a multiple of the

    frequency resolution

    The tone frequency is not a multiple of the

    frequency resolution

    2

    -2

    -1

    0

    1

    0.50.0 0.1 0.2 0.3 0.4

    Time signal 20

    -60

    -40

    -20

    0

    500 5 10 15 20 25 30 35 40 45

    FFT SpectrumVolt

    ms

    kHz

    dBV

    Fsampling = 100 kHz Record size = 50 samples

    Time res = 10 us Freq. res = 2 kHz

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    8/33

    www.natinst.comwww.natinst.com

    Input Frequency Hits Exactly a BinInput Frequency Hits Exactly a Bin

    Only one bin

    is activated

    Only one bin

    is activated

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    9/33

    www.natinst.comwww.natinst.com

    Input Frequency is +0.01 Bin offInput Frequency is +0.01 Bin off

    More bins

    are

    activated

    More bins

    are

    activated

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    10/33

    www.natinst.comwww.natinst.com

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

    Input Frequency is +0.25 Bin offInput Frequency is +0.25 Bin off

    Real top

    Highest Bin

    Next Highest

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    11/33

    www.natinst.comwww.natinst.com

    Input Frequency is +0.50 Bin offInput Frequency is +0.50 Bin off

    Highest

    side-lobes

    Highest

    side-lobes

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    12/33

    www.natinst.comwww.natinst.com

    Input Frequency is +0.75 Bin offInput Frequency is +0.75 Bin off

    The Side

    lobe levels

    decrease

    The Side

    lobe levels

    decrease

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    13/33

    www.natinst.comwww.natinst.com

    Input Frequency is +1.00 Bin offInput Frequency is +1.00 Bin off

    Only one

    bin is

    activated

    Only one

    bin is

    activated

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    14/33

    www.natinst.comwww.natinst.com

    1.1

    -0.3-0.2

    0.0

    0.2

    0.4

    0.6

    0.8

    1.0

    4-4 -3 -2 -1 0 1 2 3 Bin

    The Envelope FunctionThe Envelope Function

    Real top

    Highest Bin = a

    Next highestBin = b

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    15/33

    www.natinst.comwww.natinst.com

    The MathematicsThe Mathematics

    Envelope function:

    Bin offset:

    Real amplitude:

    Envelope function:

    Bin offset:

    Real amplitude:

    bin)(

    bin)Sin(Env

    =

    b)(a

    bbin

    +=

    bin)Sin(bin)(aAmp

    =

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    16/33

    www.natinst.comwww.natinst.com

    DemoDemo

    Amplitude and frequency detection by

    Sin(x) / x interpolation

    Amplitude and frequency detection by

    Sin(x) / x interpolation

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    17/33

    www.natinst.comwww.natinst.com

    0

    -60

    -50

    -40

    -30

    -20

    -10

    100 1 2 3 4 5 6 7 8 9

    dB

    Bin

    Aliasing of the Side-LobesAliasing of the Side-LobesHighest Bin =

    Bin 4

    Aliased Bin =

    Negative Bin 4

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    18/33

    www.natinst.comwww.natinst.com

    Weighted MeasurementWeighted Measurement

    Apply a Window to the signal Apply a Window to the signal

    2

    -2

    -1

    0

    1

    0.50.0 0.1 0.2 0.3 0.4

    Volt

    ms

    2

    -2

    -1

    0

    1

    0.50.0 0.1 0.2 0.3 0.4

    Volt

    ms

    2

    -2

    -1

    0

    1

    0.50.0 0.1 0.2 0.3 0.4

    Volt

    ms

    Hanning windowone period of ( 1 - COS )

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    19/33

    www.natinst.comwww.natinst.com

    Weighted Spectrum MeasurementWeighted Spectrum Measurement

    Apply a Window to the Signal Apply a Window to the Signal

    20

    -60

    -40

    -20

    0

    250 5 10 15 20

    Without Window

    kHz

    dBV

    20

    -60

    -40

    -20

    0

    250 5 10 15 20

    With Hanning Window

    kHz

    dBV

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    20/33

    www.natinst.comwww.natinst.com

    Rectangular and Hanning WindowsRectangular and Hanning Windows

    Side lobes

    for Hanning

    Window aresignificantly

    lower than

    for

    Rectangularwindow

    Side lobes

    for Hanning

    Window aresignificantly

    lower than

    for

    Rectangularwindow

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    21/33

    www.natinst.comwww.natinst.com

    Input Frequency Exactly Hits a BinInput Frequency Exactly Hits a Bin

    Three bins

    are

    activated

    Three bins

    are

    activated

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    22/33

    www.natinst.comwww.natinst.com

    Input Frequency is +0.25 Bin offInput Frequency is +0.25 Bin off

    More bins

    are

    activated

    More bins

    are

    activated

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    23/33

    www.natinst.comwww.natinst.com

    Input Frequency is +0.50 Bin offInput Frequency is +0.50 Bin off

    Highest

    side-lobes

    Highest

    side-lobes

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    24/33

    www.natinst.comwww.natinst.com

    Input Frequency is +0.75 Bin offInput Frequency is +0.75 Bin off

    The Side

    lobe levels

    decrease

    The Side

    lobe levels

    decrease

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    25/33

    www.natinst.comwww.natinst.com

    Input Frequency is +1.00 Bin offInput Frequency is +1.00 Bin off

    Only three

    bins

    activated

    Only three

    bins

    activated

    0

    -60

    -50

    -40

    -30

    -20

    -10

    6-6 -5 -4 -3 -2 -1 0 1 2 3 4 5

    dB

    Bin

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    26/33

    www.natinst.comwww.natinst.com

    The Mathematics for Hanning ...The Mathematics for Hanning ...

    Envelope:

    Bin Offset:

    Amplitude:

    Envelope:

    Bin Offset:

    Amplitude:

    )bin(1bin)(

    bin)Sin(Env

    2

    =

    b)(a

    2b)-(abin

    +=

    )bin1(bin)Sin(

    bin)(aAmp 2

    =

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    27/33

    www.natinst.comwww.natinst.com

    A LabVIEW ToolA LabVIEW Tool

    Tone detector LabVIEW virtual instrument (VI) Tone detector LabVIEW virtual instrument (VI)

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    28/33

    www.natinst.comwww.natinst.com

    DemoDemo

    Amplitude and frequency detection using a

    Hanning Window (named after Von Hann)

    Real world demo using:

    The NI-5411 ARBitrary Waveform Generator

    The NI-5911 FLEXible Resolution Oscilloscope

    Amplitude and frequency detection using a

    Hanning Window (named after Von Hann)

    Real world demo using:

    The NI-5411 ARBitrary Waveform Generator

    The NI-5911 FLEXible Resolution Oscilloscope

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    29/33

    www.natinst.comwww.natinst.com

    Frequency Detection ResolutionFrequency Detection Resolution1000.00

    0.01

    0.10

    1.00

    10.00

    100.00

    1001 10

    Freq error (ppm)ppm

    Signal periods

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    30/33

    www.natinst.comwww.natinst.com

    Amplitude Detection ResolutionAmplitude Detection Resolution1000.00

    0.01

    0.10

    1.00

    10.00

    100.00

    1001 10

    Amplitude error (ppm)

    Signal periods

    ppm

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    31/33

    www.natinst.comwww.natinst.com

    Phase Detection ResolutionPhase Detection Resolution1000.00

    0.01

    0.10

    1.00

    10.00

    100.00

    1001 10

    Phase error (mdeg)

    Signal periods

    mdeg.

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    32/33

    www.natinst.comwww.natinst.com

    ConclusionsConclusions

    Traditional counters resolve 10 digits in one

    second

    FFT techniques can do this in much less than100 ms

    Another example of 10X for test

    Similar improvements apply to amplitude and

    phase

    Traditional counters resolve 10 digits in one

    second

    FFT techniques can do this in much less than100 ms

    Another example of 10X for test

    Similar improvements apply to amplitude and

    phase

  • 8/14/2019 Fast Frequency and Response Measurements Using FFTs

    33/33

    www natinst comwww natinst com

    Conclusions (Notes Page Only)Conclusions (Notes Page Only)

    Traditional Counters Resolve 10 digits in one

    second

    FFT Techniques can do this in much lessthan 100 ms

    Another example of 10X for test

    Similar improvements apply to Amplitude and

    Phase

    Traditional Counters Resolve 10 digits in one

    second

    FFT Techniques can do this in much lessthan 100 ms

    Another example of 10X for test

    Similar improvements apply to Amplitude and

    Phase