ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
Fast fourier transform
1. April, 12th
2020
Discrete Fourier Transform and Fast Fourier Transform
1
auliakhalqillah.mail@gmail.com
Discrete Fourier Transform and Fast Fourier Transform
Fourier Transform (FT) is the most method that used in signal processing. FT is useful
to transform time domain to frequency domain and vice versa that we call Inverse
Fourier Transform (IFT). In this article, I want to explain about continuous and discrete
of FT also Fast Fourier Transform (FFT).
We start from the continues form of FT is
𝐹(𝜔) = ∫ 𝑓(𝑥)𝑒−𝑖𝜔𝑥
𝑑𝑥
∞
−∞
(1)
𝑓(𝑥) is the function of time/signal
𝑤 is the frequency domain
𝑥 is the time domain
variable of 𝑥 is replaced by 𝑡, then
𝐹(𝜔) = ∫ 𝑓(𝑡)𝑒−𝑖𝜔𝑡
𝑑𝑡
∞
−∞
(2)
where 𝜔 = 2𝜋𝑓𝑛 and 𝑓
𝑛 =
𝑛
𝑡
and 𝑡 = 𝑁. Δ𝑡
𝐹(𝜔) = ∫ 𝑓(𝑡)𝑒−𝑖2𝜋𝑓𝑛𝑡
𝑑𝑡
∞
−∞
(3)
Then, we can rewrite the equation (3) to discrete form
𝑋𝑛 = ∑ 𝑥𝑘𝑒−𝑖2𝜋𝑓𝑛𝑡𝑘
𝑁−1
𝑘=0 (4)
𝑋𝑛 = ∑ 𝑓𝑘𝑒−𝑖2𝜋
𝑛
𝑡
𝑡𝑘
𝑁−1
𝑘=0 (5)
where 𝑡𝑘 = 𝑘Δ𝑡 and 𝑡 = 𝑁Δ𝑡, then
𝑋𝑛 = ∑ 𝑓𝑘𝑒−𝑖2𝜋
𝑛
𝑁Δ𝑡
𝑘Δ𝑡
𝑁−1
𝑘=0 (6)
𝑋𝑛 = ∑ 𝑓𝑘𝑒−𝑖2𝜋
𝑛
𝑁
𝑘
𝑁−1
𝑘=0 (7)
𝑋𝑛 = ∑ 𝑓𝑘𝑒−𝑖
2𝜋
𝑁
𝑘𝑛
𝑁−1
𝑘=0 (8)
we can write 𝑊𝑁 = 𝑒−
𝑖2𝜋
𝑁 , so equation (8) can be rewritten
𝑋𝑛 = ∑ 𝑓𝑘𝑊𝑁
𝑘𝑛
𝑁−1
𝑘=0 (9)
where 𝑛 = 0,1,2,3, … … 𝑁 − 1 and 𝑁 is number of samples
Cosine and Sine Form
The equation (8) is the final Discrete Fourier Transform (DFT). It can be written as
cosine (real part) and sine (imaginary part) term as follows
2. April, 12th
2020
Discrete Fourier Transform and Fast Fourier Transform
2
auliakhalqillah.mail@gmail.com
remember that
𝑒±𝑖𝜃
= cos(𝜃) ± 𝑖 sin (𝜃)
𝜃 =
2𝜋
𝑁
𝑘𝑛
𝑋𝑛 = ∑ 𝑥𝑘 [cos (
2𝜋
𝑁
𝑘𝑛) − 𝑖 sin (
2𝜋
𝑁
𝑘𝑛)]
𝑁−1
𝑘=0 (10)
𝑅𝑒𝑎𝑙 𝑋𝑛 = ∑ 𝑥𝑘 cos (
2𝜋
𝑁
𝑘𝑛)
𝑁−1
𝑘=0 (11)
𝐼𝑚𝑎𝑔𝑖𝑛𝑎𝑟𝑦 𝑋𝑛 = ∑ 𝑥𝑘 i sin (
2𝜋
𝑁
𝑘𝑛)
𝑁−1
𝑘=0 (12)
Then, the equation (9) can be rewritten as
𝑋𝑛 = ∑ 𝑥𝑘[𝑅𝑒𝑎𝑙 𝑋𝑛 − 𝐼𝑚𝑎𝑔𝑖𝑛𝑎𝑟𝑦 𝑋𝑛]
𝑁−1
𝑘=0 (13)
So, the equation (13) is called Discrete Fourier Transform (DFT)
How much times to process have to be done from equation (9)?
Let’s imagine if N =100 of data will be processed. It will take N times to process for
summation part from 𝑘 𝑡𝑜 𝑁 − 1 for each 𝑛 from 𝑛 𝑡𝑜 𝑁 − 1. In order words, the process
will take 𝑁𝑥𝑁 times or 𝑁2
times and for this example, 𝑁2
= 1002
= 10000 times.
If N = 1 has to take 1 millisecond to process. So, if 𝑁2
= 10000 has to take 10000
milliseconds or equal to 10 seconds. This process is good enough for 𝑁 = 100. The
next question is, how much times to process have to be done if 𝑁 = 5000? When 𝑁 =
5000, its means 𝑁2
= 25000000 will take 25000000 milliseconds or equal to 25000
second or equal to ≈ 416 minutes or equal to ≈ 6,9 hours. It takes a long time to
process if we use equation (9) for N very huge number.
What is the solution for this problem?
Even and Odd Method
The solution is, we can split to even and odd part of equation (9). We can rewrite the
equation (9) as follows:
𝑋𝑛 = ∑ 𝑥2𝑚𝑊𝑁
2𝑚𝑛
𝑁
2
−1
𝑚=0 + ∑ 𝑥2𝑚+1𝑊
𝑁
(2𝑚+1)𝑛
𝑁
2
−1
𝑚=0 (14)
𝑋𝑛 = ∑ 𝑥2𝑚𝑊𝑁
2𝑚𝑛
𝑁
2
−1
𝑚=0 + ∑ 𝑥2𝑚+1𝑊𝑁
2𝑚𝑛
𝑊𝑁
𝑛
𝑁
2
−1
𝑚=0
𝑋𝑛 = ∑ 𝑥2𝑚𝑊𝑁
2𝑚𝑛
𝑁
2
−1
𝑚=0 + 𝑊𝑁
𝑛 ∑ 𝑥2𝑚+1𝑊𝑁
2𝑚𝑛
𝑁
2
−1
𝑚=0 (15)
3. April, 12th
2020
Discrete Fourier Transform and Fast Fourier Transform
3
auliakhalqillah.mail@gmail.com
𝐸𝑣𝑒𝑛 𝑋𝑛 = ∑ 𝑥2𝑚𝑊𝑁
2𝑚𝑛
𝑁
2
−1
𝑚=0
𝑂𝑑𝑑 𝑋𝑛 = 𝑊𝑁
𝑛 ∑ 𝑥2𝑚+1𝑊𝑁
2𝑚𝑛
𝑁
2
−1
𝑚=0
How much times to process have to be done by using equation (15)?
For an example, we use N = 4 to process by using equation (15). By using N = 4, its
means 𝑛 = 0,1,2,3 and 𝑚 = 0,1 because the last boundary of 𝑚 is
𝑁
2
− 1 =
4
2
− 1 = 1.
Then, we input the index 𝑛 and 𝑚 to the equation (15)
𝑓𝑜𝑟 𝑁 = 4, 𝑛 = 0, 𝑚 = 0,1
𝑋0 = [𝑥2(0)𝑊
4
2(0)(0)
+ 𝑥2(1)𝑊
4
2(1)(0)
] + [𝑊4
0
(𝑥2(0)+1𝑊
4
2(0)(0)
+ 𝑥2(1)+1𝑊
4
2(1)(0)
)]
𝑓𝑜𝑟 𝑁 = 4, 𝑛 = 1, 𝑚 = 0,1
𝑋1 = [𝑥2(0)𝑊
4
2(0)(1)
+ 𝑥2(1)𝑊
4
2(1)(1)
] + [𝑊4
1
(𝑥2(0)+1𝑊
4
2(0)(1)
+ 𝑥2(1)+1𝑊
4
2(1)(1)
)]
𝑓𝑜𝑟 𝑁 = 4, 𝑛 = 2, 𝑚 = 0,1
𝑋2 = [𝑥2(0)𝑊
4
2(0)(2)
+ 𝑥2(1)𝑊
4
2(1)(2)
] + [𝑊4
2
(𝑥2(0)+1𝑊
4
2(0)(2)
+ 𝑥2(1)+1𝑊
4
2(1)(2)
)]
𝑓𝑜𝑟 𝑁 = 4, 𝑛 = 3, 𝑚 = 0,1
𝑋3 = [𝑥2(0)𝑊
4
2(0)(3)
+ 𝑥2(1)𝑊
4
2(1)(3)
] + [𝑊4
3
(𝑥2(0)+1𝑊
4
2(0)(3)
+ 𝑥2(1)+1𝑊
4
2(1)(3)
)]
From the equation above, we can simplify become
𝑋0 = [𝑥0𝑊4
0
+ 𝑥2𝑊4
0] + [𝑊4
0(𝑥1𝑊4
0
+ 𝑥3𝑊4
0)]
𝑋1 = [𝑥0𝑊4
0
+ 𝑥2𝑊4
2] + [𝑊4
1(𝑥1𝑊4
0
+ 𝑥3𝑊4
2)]
𝑋2 = [𝑥0𝑊4
0
+ 𝑥2𝑊4
4] + [𝑊4
2(𝑥1𝑊4
0
+ 𝑥3𝑊4
4)]
𝑋3 = [𝑥0𝑊4
0
+ 𝑥2𝑊4
6] + [𝑊4
3(𝑥1𝑊4
0
+ 𝑥3𝑊4
6)]
where 𝑊4
0
= 1 (produced from complex plane)
𝑋0 = [𝑥0 + 𝑥2𝑊4
0] + [𝑊4
0(𝑥1 + 𝑥3𝑊4
0)]
𝑋1 = [𝑥0 + 𝑥2𝑊4
2] + [𝑊4
1(𝑥1 + 𝑥3𝑊4
2)]
𝑋2 = [𝑥0 + 𝑥2𝑊4
4] + [𝑊4
2(𝑥1 + 𝑥3𝑊4
4)]
𝑋3 = [𝑥0 + 𝑥2𝑊4
6] + [𝑊4
3(𝑥1 + 𝑥3𝑊4
6)] Figure 1 Complex Plane for N = 4
4. April, 12th
2020
Discrete Fourier Transform and Fast Fourier Transform
4
auliakhalqillah.mail@gmail.com
From the complex plane in Figure 1, 𝑊4
4
= 𝑊4
0
and 𝑊4
6
= 𝑊4
2
, so we get
𝑋0 = [𝑥0 + 𝑥2𝑊4
0] + [𝑊4
0(𝑥1 + 𝑥3𝑊4
0)]
𝑋1 = [𝑥0 + 𝑥2𝑊4
2] + [𝑊4
1(𝑥1 + 𝑥3𝑊4
2)]
𝑋2 = [𝑥0 + 𝑥2𝑊4
0] + [𝑊4
2(𝑥1 + 𝑥3𝑊4
0)]
𝑋3 = [𝑥0 + 𝑥2𝑊4
2] + [𝑊4
3(𝑥1 + 𝑥3𝑊4
2)]
We can see, the equation is repeated. Its means, the process just take 8 times or
equal to 𝑁 log2 𝑁. If we calculate the 𝑁 = 4 → 𝑁 log2 𝑁 = 4 log2 4 = 8.
Back to the illustration, if we have 𝑁 = 5000, by using even and odd method of FT, its
means 𝑁 log2 𝑁 = 5000 log2 5000 ≈ 61439,56189 ≈ 61440 times will be processed. If
N = 1 has 1 millisecond to process, then for 𝑁 ≈ 61440 has 61440 millisecond or
61,440 second or 1.024 minutes. In other words, to process 𝑁 = 5000 points by using
even and odd method, it will take 1.024 minutes of time. Very short time than using 𝑁2
process, isn’t it?
Finally, the DFT by using 𝑁 log2 𝑁 process also called Fast Fourier Transform (FFT)
So, for the good process of FFT, the recommendation of N is power of two 𝑁 = 2𝑟
,
𝑁 = 2, 𝑁 = 4, 𝑁 = 8, 𝑁 = 16 and etc.
Sources
Paul Heckbert (1998) Fourier Transforms and the Fast Fourier Transform (FFT)
Algorithm
Michael T. Heideman, Don H. Johnson, C. Sidney Burrus (1984),Gauss and the
history of the fast Fourier transform
Amente Bekele (2016),Cooley-Tukey Algorithms
Jake VanderPlas (2013), Understanding the FFT algorithm
Sho Nakagome (2019), Fourier Transform 101 – Part 5: Fast Fourier Transform (FFT)