diff --git a/ece-178-notes/docs/Notes/fast-fourier-transform.mdx b/ece-178-notes/docs/Notes/fast-fourier-transform.mdx index 85de9a0d..bf1efcf9 100644 --- a/ece-178-notes/docs/Notes/fast-fourier-transform.mdx +++ b/ece-178-notes/docs/Notes/fast-fourier-transform.mdx @@ -40,7 +40,27 @@ The algorithm, along with its recursive application, was invented by Carl Friedr The data flow diagram above[^1] shows the computation of the DFT of a sequence of length $N=8$ using the Radix-2 Decimation-In-Time (DIT) FFT algorithm. The diagram illustrates the divide-and-conquer approach of the algorithm, where the input sequence is divided into two smaller sequences, and their DFTs are computed recursively. The diagram also shows the "butterfly" operations, which combine the DFTs of the smaller sequences to form the DFT of the original sequence. -The 8-point DFT can be written as a matrix product[^2], where we let $W = e^{-i2\pi/8} = (1 - i)/\sqrt{2}$: + + +### Understanding the $8^{th}$ Root ($W$) + +The $8^{th}$ root of unity, denoted as $W$, is fundamental to the FFT algorithm. It's defined as $W = e^{-i2\pi/8}$, where $i$ is the imaginary unit. This root of unity represents the complex numbers on the unit circle in the complex plane, equidistantly spaced at angles corresponding to their fractional part of a full circle (in this case, $2\pi/8$, or $\pi/4$, radians apart). + +For $N=8$, we have: +- $W^0 = e^{0} = 1$ +- $W^1 = e^{-i\pi/4} = \frac{1 - i}{\sqrt{2}}$ +- $W^2 = e^{-i\pi/2} = -i$ +- $W^3 = e^{-3i\pi/4} = \frac{-1 - i}{\sqrt{2}}$ +- $W^4 = e^{-i\pi} = -1$ +- $W^5 = e^{-5i\pi/4} = \frac{-1 + i}{\sqrt{2}}$ +- $W^6 = e^{-3i\pi/2} = i$ +- $W^7 = e^{-7i\pi/4} = \frac{1 + i}{\sqrt{2}}$ + +These values of $W^k$ illustrate the symmetry and periodicity inherent in the DFT and are critical for the "butterfly" calculations in the FFT algorithm. + +### Matrix Representation + +The DFT matrix for $N=8$, incorporating the simplified $W^k$ values, provides a clear visualization of the FFT's operation: $$ \begin{align*} @@ -57,13 +77,13 @@ A_7 \\ &= \begin{bmatrix} 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ -1 & W^1 & W^2 & W^3 & W^4 & W^5 & W^6 & W^7 \\ +1 & W & W^2 & W^3 & W^4 & W^5 & W^6 & W^7 \\ 1 & W^2 & W^4 & W^6 & 1 & W^2 & W^4 & W^6 \\ -1 & W^3 & W^6 & W^1 & 1 & W^3 & W^6 & W^1 \\ -1 & W^4 & 1 & W^5 & 1 & W^4 & 1 & W^5 \\ -1 & W^5 & W^2 & W^7 & 1 & W^5 & W^2 & W^7 \\ +1 & W^3 & W^6 & W^1 & W^4 & W^7 & W^2 & W^5 \\ +1 & W^4 & 1 & W^4 & 1 & W^4 & 1 & W^4 \\ +1 & W^5 & W^2 & W^7 & W^4 & W & W^6 & W^3 \\ 1 & W^6 & W^4 & W^2 & 1 & W^6 & W^4 & W^2 \\ -1 & W^7 & W^6 & W^1 & 1 & W^7 & W^6 & W^1 \\ +1 & W^7 & W^6 & W^5 & W^4 & W^3 & W^2 & W \\ \end{bmatrix} \begin{bmatrix} x_0 \\ @@ -78,6 +98,25 @@ x_7 \\ \end{align*} $$ +This representation, with the explicit inclusion of $W^k$ values, elucidates the FFT's efficiency in decomposing the DFT into smaller, manageable components. + +### Butterfly Operations Explained + +Butterfly operations are the core computational elements of the FFT algorithm. They represent the pairwise combination of DFT outputs from smaller sequences. A "butterfly" operation takes two complex numbers, multiplies one of them by a twiddle factor (a power of $W$), and then performs addition and subtraction to produce two new complex numbers. + +For a single stage in an $N=8$ FFT, a butterfly operation on inputs $a$ and $b$ with a twiddle factor $W^k$ can be represented as: + +- Output 1: $a + W^k \cdot b$ +- Output 2: $a - W^k \cdot b$ + +These operations halve the computation required at each stage by reusing results, demonstrating the FFT's divide-and-conquer strategy. The recursive application of butterfly operations across the stages of the FFT leads to its $\mathcal{O}[N\log N]$ complexity, a significant improvement over the $\mathcal{O}[N^2]$ complexity of the direct DFT computation. + + + + + + + #### Pseudocode diff --git a/ece-178-notes/node_modules/.cache/webpack/client-development-en/0.pack b/ece-178-notes/node_modules/.cache/webpack/client-development-en/0.pack index 8a502ae8..4f44e6dc 100644 Binary files a/ece-178-notes/node_modules/.cache/webpack/client-development-en/0.pack and b/ece-178-notes/node_modules/.cache/webpack/client-development-en/0.pack differ diff --git a/ece-178-notes/node_modules/.cache/webpack/client-development-en/2.pack b/ece-178-notes/node_modules/.cache/webpack/client-development-en/2.pack index de404e9f..32a5da9a 100644 Binary files a/ece-178-notes/node_modules/.cache/webpack/client-development-en/2.pack and b/ece-178-notes/node_modules/.cache/webpack/client-development-en/2.pack differ diff --git a/ece-178-notes/node_modules/.cache/webpack/client-development-en/3.pack b/ece-178-notes/node_modules/.cache/webpack/client-development-en/3.pack index d4565238..a775ff92 100644 Binary files a/ece-178-notes/node_modules/.cache/webpack/client-development-en/3.pack and b/ece-178-notes/node_modules/.cache/webpack/client-development-en/3.pack differ diff --git a/ece-178-notes/node_modules/.cache/webpack/client-development-en/4.pack b/ece-178-notes/node_modules/.cache/webpack/client-development-en/4.pack index 2d7c4b31..8ac82085 100644 Binary files a/ece-178-notes/node_modules/.cache/webpack/client-development-en/4.pack and b/ece-178-notes/node_modules/.cache/webpack/client-development-en/4.pack differ diff --git a/ece-178-notes/node_modules/.cache/webpack/client-development-en/5.pack b/ece-178-notes/node_modules/.cache/webpack/client-development-en/5.pack index 470215bf..5eead11d 100644 Binary files a/ece-178-notes/node_modules/.cache/webpack/client-development-en/5.pack and b/ece-178-notes/node_modules/.cache/webpack/client-development-en/5.pack differ diff --git a/ece-178-notes/node_modules/.cache/webpack/client-development-en/6.pack b/ece-178-notes/node_modules/.cache/webpack/client-development-en/6.pack index 5a252f17..20d5f4dd 100644 Binary files a/ece-178-notes/node_modules/.cache/webpack/client-development-en/6.pack and b/ece-178-notes/node_modules/.cache/webpack/client-development-en/6.pack differ diff --git a/ece-178-notes/node_modules/.cache/webpack/client-development-en/index.pack b/ece-178-notes/node_modules/.cache/webpack/client-development-en/index.pack index 86f2a490..3e5971b1 100644 Binary files a/ece-178-notes/node_modules/.cache/webpack/client-development-en/index.pack and b/ece-178-notes/node_modules/.cache/webpack/client-development-en/index.pack differ diff --git a/ece-178-notes/node_modules/.cache/webpack/client-development-en/index.pack.old b/ece-178-notes/node_modules/.cache/webpack/client-development-en/index.pack.old index 50f212c9..d8108c34 100644 Binary files a/ece-178-notes/node_modules/.cache/webpack/client-development-en/index.pack.old and b/ece-178-notes/node_modules/.cache/webpack/client-development-en/index.pack.old differ