Fourier Transform and Fast Fourier Transform Algorithms

Upload
huynhbach 
Category
Documents

view
270 
download
0
Transcript of Fourier Transform and Fast Fourier Transform Algorithms

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
1/42
1
FOURIER TRANSFORM (FT) AND
FAST FOURIER TRANSFORM (FFT)ALGORITHMS
Lectured by Assoc Prof. Dr. Thuong LeTienSeptember 2011
DIGITAL SIGNAL PROCESSING

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
2/42
2DSP lectured by Assoc. Prof. Dr. Thuong LeTien
1. Frequency resolution and windowing
Spectrum of sampled analog signal
But if the replicas overlap they will contribute to the right hand side of spectrum
In terms of the time samples x(nT), the original sampled spectrum
and its timewindowed version are given by:
)( fX
)( fXL

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
3/42
3DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Rectangular window of length L
Then define the windowed signal
The DTFT of windowed signal is
Where W() is the DTFT of the rectangular window w(n)

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
4/42
4DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Setting W(n) = 1
Magnitude spectrum
of rectangular window
Magnitude spectrum
of rectangular window
Rectangular window width

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
5/42
5DSP lectured by Assoc. Prof. Dr. Thuong LeTien

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
6/42
6DSP lectured by Assoc. Prof. Dr. Thuong LeTien
To achieve a desired frequency resolution f.The smaller the desired separation, the
Longer the data record
The Hamming window
The Hamming window
At its center, n=(L1)/2, the value of w(n) is 0.54+0.46 = 1, and at its endpoint,
n=0 and n=L1, its value is 0.540.46 = 0.08
For any type of window, the effective of the
mainlobe is inversely proportional to L
For any type of window, the effective of the
mainlobe is inversely proportional to L
c is a constant and always c=>1
Frequency resolution
Frequency resolution

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
7/42
7DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Hamming window in the time and frequency domain
The minimum resolvable frequency differenceThe minimum resolvable frequency difference

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
8/42
8
DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Example:
A signal consisting of four sinusoids of frequencies of 1, 1.5, 2.5,and 2.75 kHz, is sampled at a rate of 10 kHz. What is the minimum
number of samples that should be collected for the frequency
spectrum to exhibit four distinct peaks at these frequencies?
How many samples should be collected if they are going to be
preprocessed by a Hamming window and then Fourier transformed?
Solution:The smallest frequency separation that must be resolved by the DFT is
f = 2.752.5=0.25 kHz, for rectangular window:
Because the mainlobe width of the Hamming window is twice aswide as that of the rectangular window, it follows that twice as
many samples must be collected, that is L=80 then c can be
calculated to be c=2

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
9/42
9DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Example:A 10ms portion of a signal is sampled at a rate of 10kHz. It is known
that the signal consists of two sinusoids of frequencies f1
=1kHz and
f2=2khz. It is also known that the signal contains a third component
of frequency f3 that lies somewhere between f1 and f2.
a. How close to f1 could f3 be in order for the spectrum of the collected
samples to exhibit three distinct peak? How close to f2 could f3 be?
b.What are the answers if the collected samples are windowed by a
Hamming window?
Solution:
The total number of samples collected is L= fsTL =10x10=100.
The frequency resolution of the rectangular window is
f = fs/L = 10/100 = 0.1kHz
Thus the closest f3 to f1 and f2 will bef3 = f1 + f = 1.1kHz and f3 = f2  f = 1.9kHz
In the hamming case, the minimum resolvable frequency separation
doubles, that is,
f = cfs/L = 2.10/100 = 0.2kHz which give f3 = 1.2kHz or f3 = 1.8kHz

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
10/42
10DSP lectured by Assoc. Prof. Dr. Thuong LeTien
2. DTFT computation2.1. DTFT at a single frequency
Rectangular and hamming windows with L=40 and 100Rectangular and hamming windows with L=40 and 100
DTFT of lengthL signal

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
11/42
11
DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Equivalent Nyquist Interval
2.2. DFT over frequency range: Compute DFT over2.2. DFT over frequency range: Compute DFT over

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
12/42
12
DSP lectured by Assoc. Prof. Dr. Thuong LeTien
2.3. DFTThe N points DFT of a Llength signal defined the DFT frequency as follows,
2.3. DFTThe N points DFT of a Llength signal defined the DFT frequency as follows,
The only difference between DFT and DTFT is that the former has its N
frequencies distributed evenly over the full Nyquist interval [0, 2) whereas
the later has them distributed over any desired subinterval.
The only difference between DFT and DTFT is that the former has its N
frequencies distributed evenly over the full Nyquist interval [0, 2) whereas
the later has them distributed over any desired subinterval.

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
13/42
13DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Evaluation of ztransformEvaluation of ztransform
Nth roots of unity for N=8Nth roots of unity for N=8
The periodicity of X() with a period of 2 or
DFT X(k)=X(k) in the index k with period N
The periodicity of X() with a period of 2 or
DFT X(k)=X(k) in the index k with period N
Npoint DTFTs over [0,2) and over subinterval [a, b), for N=10Npoint DTFTs over [0,2) and over subinterval [a, b), for N=10

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
14/42
14DSP lectured by Assoc. Prof. Dr. Thuong LeTien
2.4. Zeros padding2.4. Zeros padding
Note that evaluation at the N frequencies DFT are the same for
the cases of padding D zeros at front or delay D samples

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
15/42
15DSP lectured by Assoc. Prof. Dr. Thuong LeTien
The DTFT and DFT
2.5. The matrix form of DFT2.5. The matrix form of DFT
Denoted
Where the matrix components
defined by twiddle factors
Where the matrix components
defined by twiddle factors
(matrix form of DFT)(matrix form of DFT)

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
16/42
16DSP lectured by Assoc. Prof. Dr. Thuong LeTien
The twiddle factor defined by
For example: L=N and N=2, 4, 8
The corresponding 2point and 4point DFT matrices are:

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
17/42
17DSP lectured by Assoc. Prof. Dr. Thuong LeTien
17
And the 2point and 4point DFT of a length 2 and length 4 signals will be
Thus, the 2point DFT is formed by taking the sum and difference of the two time
Samples. It will be a convenience starting point for the merging in FFT by hand.
Thus, the 2point DFT is formed by taking the sum and difference of the two time
Samples. It will be a convenience starting point for the merging in FFT by hand.

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
18/42
18
Twiddle factor look up tables for N=2, 4, 8
5. Modulo N reduction
Example L=4N
5. Modulo N reduction
Example L=4N
DSP lectured by Assoc. Prof. Dr. Thuong LeTien

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
19/42
19DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Example: Determine the mod4 and mod3 reduction of the length8 signal vector
For N=4 and N=3
For n=0, 1, 2, , N1

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
20/42
20
Periodic extension interpretation of modN reduction of a signal
The connection of the modN reduction to the DFT is the theorem that theLengthN wrapped signal x~ has the same Npoint DFT as the original
Unwrapped signal x, that is:
The connection of the modN reduction to the DFT is the theorem that theLengthN wrapped signal x~ has the same Npoint DFT as the original
Unwrapped signal x, that is:

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
21/42
21DSP lectured by Assoc. Prof. Dr. Thuong LeTien
The DFT matrices A and A~ have the same definition, except they
differ in their dimensions, which are NxL and NxN, respectively.
We can write the DFT of x~ in the compact matrix form:
The DFT matrices A and A~ have the same definition, except they
differ in their dimensions, which are NxL and NxN, respectively.
We can write the DFT of x~ in the compact matrix form:
In general A is partitioned in the form:In general A is partitioned in the form:

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
22/42
22DSP lectured by Assoc. Prof. Dr. Thuong LeTien

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
23/42
23DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Npoint DFTs of the full and wrapped signal are equivalentNpoint DFTs of the full and wrapped signal are equivalent

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
24/42
24DSP lectured by Assoc. Prof. Dr. Thuong LeTien
The same DFT can be computed by the DFT matrixx~ acted on the wrapped signal x~
The two methods are the same
Example: Compute the 4point DFT of the length8 signal in two way:(a) Working with the full unwrapped vector x and
(b) Computing the DFT of its mod4 reduction
Solution: The corresponding DFT is

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
25/42
25DSP lectured by Assoc. Prof. Dr. Thuong LeTien
6. Inverse DFTThe problem for inverse DFT is the length L of signal greater than Npoint DFT,
i.e. the matrix A is not invertible
The inverse DFT defined byThe inverse DFT defined by
Where IN is the Ndimensional identity matrix and is the complex
conjugate of , obtained by conjugating every matrix element of .
For example, for N=4, we can verify easily:
*~ ~~

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
26/42
26DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Similar for FFT
Example for an inverse 4point DFT

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
27/42
27DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Therefore the alternative form of IDFTTherefore the alternative form of IDFT
DFT and IDFTDFT and IDFT
In term of the DFT frequencies k , we have Xk = X(k ) and

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
28/42
28DSP lectured by Assoc. Prof. Dr. Thuong LeTien
7. Sampling of periodic signals and DFT
Discrete Fourier series (DFS)Discrete Fourier series (DFS)
X~ is periodic in n with period N
Sampling rate is a multiple of the fundamental frequency of signalSampling rate is a multiple of the fundamental frequency of signal
Taking the Nyquist interval to be the rightsided one [0, fs], we note that
harmonics within that interval are none other than the N DFT frequencies
Taking the Nyquist interval to be the rightsided one [0, fs], we note that
harmonics within that interval are none other than the N DFT frequencies

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
29/42
29DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Given an integer m, we determine its quotient and reminder of the division
And therefore the corresponding harmonic will be
Defining the aliased Fourier series amplitudes
* Which shows that fm will be aliased with fk. Therefore, if thesignal x(t) is sampled, it will give rise to the samples

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
30/42
30DSP lectured by Assoc. Prof. Dr. Thuong LeTien
If the sampled signal x(nT) be reconstructed by an ideal reconstructor,
the aliased analog waveform is
Example: determine the aliased signal xal(t) resulting by sampling a square
Wave of frequency f1=1 Hz. For a sampling rate of fs = 4Hz, consider one period
Consisting of N=4 samples and perform its 4point DFT
The Fourier coefficients:
Corresponding to the harmonic
Where f3 = 3 was replaced by its negative version f3fs = 34 = 1. It follows that
the aliased signal will be

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
31/42
31DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Similarly, for N=8 corresponding to fs=8 Hz, we perform the 8point DFT of one
period of the square wave, and divide by 8 to get the aliased amplitudes
These amplitudes corresponding to the frequencies fk = k f1

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
32/42
32DSP lectured by Assoc. Prof. Dr. Thuong LeTien
8. Fast Fourier Transform FFTIs a fast implementation of DFT. It is based on a divide and conquer
approach in which the DFT computation is divided into smaller, simpler,
problems and the final DFT is rebuilt from the simpler DFTs.It is required the initial dimension of N to be power of two
The problem of computing the Npoint
DFT is replaced by the simpler problems
of computing two (N/2)point DFT.

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
33/42
33DSP lectured by Assoc. Prof. Dr. Thuong LeTien
The summation index n ranges over both even and odd valuesin the range [0,N1]. By grouping the evenindexed and
oddindexed terms, we get
To determine the proper range of summation over n, we consider the twoTerms separately. For evenindexed terms, the index 2n must be within the
range [0,N1]. But, because N is even (a power of two), the upper limit
N1 will be odd. Therefore, the highest even index will be N2,
12/0220 NnNn
Similarly, for the oddindexed terms, we must have
1120 Nn
12/02201121 NnNnnn

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
34/42
34DSP lectured by Assoc. Prof. Dr. Thuong LeTien

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
35/42
35DSP lectured by Assoc. Prof. Dr. Thuong LeTien

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
36/42
36DSP lectured by Assoc. Prof. Dr. Thuong LeTien
The butterfly merging buildsupper and lower halves of
lengthN DFT
The butterfly merging buildsupper and lower halves of
lengthN DFT

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
37/42
37DSP lectured by Assoc. Prof. Dr. Thuong LeTien
and N=8and N=8

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
38/42
38DSP lectured by Assoc. Prof. Dr. Thuong LeTien
The typical algorithm consists of three conceptual parts:1. Shuffling the Ndimensional input into N of 1D signals2. Performing N onepoint DFTs3. Merging the N onepoint DFTs into one Npoint DFT

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
39/42
39DSP lectured by Assoc. Prof. Dr. Thuong LeTien

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
40/42
40DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Example: Using FFT algorithm, compute the 4point
wrapped signal (5, 0, 3, 4)
Solution:The DFT merging stage merges the two 2DFTsinto the final 4DFT

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
41/42
41DSP lectured by Assoc. Prof. Dr. Thuong LeTien
Example: Using FFT algorithm, compute 8point DFT of the 8 point signal

8/11/2019 Fourier Transform and Fast Fourier Transform Algorithms
42/42
42
Example: 8point Inverse FFT
DSP lectured by Assoc. Prof. Dr. Thuong LeTien