You are on page 1of 33

# Fast Frequency and Response Measurements using FFTs

Alain Moriat, Senior Architect Fri. 12:45p Pecan (9B)
www.natinst.com

Accurately 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?

www.natinst.com

Presentation Overview
       Why use the frequency domain? FFT – a short introduction Frequency interpolation Improvements using windowing Error evaluation Amplitude/phase response measurements Demos

www.natinst.com

Clean Single Tone Measurement
2 Volt 1 0 -1 -2 0.0

Tim signal e

20 dBV 0 -20 -40 -60 0

FFT Spectrum

kHz 5 10 15 20 25 30 35 40 45 50

0.2

0.4

0.6

0.8m 1.0 s

 Clean sine tone  Easy to measure

 Clean tone spectrum

www.natinst.com

Noisy Tone Measurement
2 Volt 1 0 -1 -2 0.0

Our signal

Tim signal e

20 dBV 0 -20 -40 -60 0

FFT Spectrum

kHz 5 10 15 20 25 30 35 40 45 50

0.2

0.4

0.6

0.8m 1.0 s

 Noisy signal  Difficult to measure in the time domain
www.natinst.com

 Noisy signal spectrum  Easier to measure

Fast Fourier Transform (FFT) Fundamentals (Ideal Case)
2 Volt 1 0 -1 -2 0.0

Tim signal e

20 dBV 0 -20 -40 -60 0

FFT Spect rum

0.1

0.2

0.3

0.4m 0.5 s

Fsam pling =100 kHz Tim res =10 us e

Record size =50 sam ples Freq. res =2 kHz

5 10 15 20 25 30 35 40 45 50 kHz

 The tone frequency is an exact multiple of the frequency resolution (“hits a bin”)
www.natinst.com

FFT Fundamentals (Realistic Case)
2 Volt 1 0 -1 -2 0.0

Tim signal e

20 dBV 0 -20 -40 -60 0

FFT Spect rum

0.1

0.2

0.3

0.4m 0.5 s

Fsam pling =100 kHz Tim res =10 us e

Record size =50 sam ples Freq. res =2 kHz

5 10 15 20 25 30 35 40 45 50 kHz

 The tone frequency is not a multiple of the frequency resolution
www.natinst.com

Input Frequency Hits Exactly a Bin
0 dB -10 -20 -30 -40 -50 -60 -6

 Only one bin is activated

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +0.01 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

 More bins are activated

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +0.25 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

Real top
Highest Bin Next Highest Bin

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +0.50 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

 Highest side-lobes

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +0.75 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

 The Side lobe levels decrease

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +1.00 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

 Only one bin is activated

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

The Envelope Function
1.1 1.0 0.8 0.6 0.4 0.2 0.0 -0.2 -0.3 -4

Real top Highest Bin = a Next highest Bin = b

-3

-2

-1

0

1

2

3

Bin 4

www.natinst.com

The Mathematics
 Envelope function:

Sin( π ⋅ bin) Env = (π ⋅ bin) b Δbin = ± (a + b)
(π ⋅ Δbin) Amp = a ⋅ Sin( π ⋅ Δbin)

 Bin offset:

 Real amplitude:

www.natinst.com

Demo
 Amplitude and frequency detection by Sin(x) / x interpolation

www.natinst.com

Aliasing of the Side-Lobes
0 dB -10 -20 -30 -40 -50 -60

Highest Bin = Bin 4

Aliased Bin = “Negative Bin 4”

0

1

2

3

4

5

6

7

8

9 Bin 10

www.natinst.com

Weighted Measurement
 Apply a Window to the signal
2 Volt 1 0 -1 -2 0.0 2 Volt 1 0 -1 -2 0.0

0.1

0.2

0.3

0.4ms 0.5

0.1

0.2

0.3

0.4ms 0.5

Hanning window – one period of ( 1 - COS ) www.natinst.com

Weighted Spectrum Measurement
 Apply a Window to the Signal
20 dBV 0 -20 -40 -60 0 5 10 15 20 25 kHz

Without Window

20With dBV 0 -20 -40 -60 0

Hanning Window

5

10

15

20 25 kHz

www.natinst.com

Rectangular and Hanning Windows
0 dB -10 -20 -30 -40 -50 -60 -6

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

 Side lobes for Hanning Window are significantly lower than for Rectangular window

www.natinst.com

Input Frequency Exactly Hits a Bin
0 dB -10 -20 -30 -40 -50 -60 -6

 Three bins are activated

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +0.25 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

 More bins are activated

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +0.50 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

 Highest side-lobes

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +0.75 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

 The Side lobe levels decrease

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

Input Frequency is +1.00 Bin “off”
0 dB -10 -20 -30 -40 -50 -60 -6

 Only three bins activated

-5

-4

-3

-2

-1

0

1

2

3

4

5 Bin 6

www.natinst.com

The Mathematics for Hanning ...
Sin( π ⋅ bin)  Envelope: Env = (π ⋅ bin) ⋅ (1 − bin 2 ) (a - 2b)  Bin Offset: Δbin = ± (a + b)
(π ⋅ Δbin)  Amplitude: Amp = a ⋅ ⋅ (1 −Δbin 2 ) Sin( π ⋅ Δbin)
www.natinst.com

A LabVIEW Tool

 Tone detector LabVIEW virtual instrument (VI)
www.natinst.com

Demo
 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

www.natinst.com

Frequency Detection Resolution
1000.00 100.00 10.00 1.00 0.10 0.01 1 10

ppm

Freq error (ppm )

Signal periods

100

www.natinst.com

Amplitude Detection Resolution
1000.00 100.00 10.00 1.00 0.10 0.01 1 10

ppm

Amplitude error (ppm)

Signal periods

100

www.natinst.com

Phase Detection Resolution
1000.00

m deg.

Phase error (m deg)

100.00 10.00 1.00 0.10 0.01 1 10

Signal periods

100

www.natinst.com

Conclusions
 Traditional counters resolve 10 digits in one second  FFT techniques can do this in much less than 100 ms  Another example of 10X for test  Similar improvements apply to amplitude and phase

www.natinst.com

Conclusions (Notes Page Only)
 Traditional Counters Resolve 10 digits in one second  FFT Techniques can do this in much less than 100 ms  Another example of 10X for test  Similar improvements apply to Amplitude and Phase

www.natinst.com