Skip to content

Commit

Permalink
update writing styles, fix grammar or typos, and clarify informations.
Browse files Browse the repository at this point in the history
  • Loading branch information
glennhenry committed Aug 7, 2024
1 parent 3170917 commit 92c5723
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,18 @@ Fourier transform formula for continuous signal is given by below.

![Fourier transform formula involving complex exponential term with the function of time representing the signal](./fourier-transform-formula.png)

- $\omega$ is the frequency with unit of radians per unit time.
- $F(\omega)$ is the output of Fourier transform with input frequency $\omega$.
- $f(t)$ is the original signal in the time domain.
- $\omega$ is the frequency with unit of radians per unit time
- $F(\omega)$ is the output of Fourier transform with input frequency $\omega$
- $f(t)$ is the original function of signal in the time domain
- $e^{-i\omega t}$ is a complex exponential term.

The complex exponential term is used to represent the oscillating property of the wave. In this formula, wave is represented as a vector that has certain magnitude, which correspond to the amplitude of the sinusoidal wave.

In the wave, phase angle represents the phase shift of the wave relative to a reference point. With the vector, this is represented with the $\theta$.

Multiplying the $f(t)$ with the exponential term would make the vector now rotate based on the function.
The complex exponential term is used to represent wave in terms of sine and cosine waves (by [utilizing Euler's identity](/digital-signal-processing/fourier-series#complex-fourier-series)). In this formula, wave is represented as a vector that has certain magnitude, which correspond to the amplitude of the sinusoidal wave.

![Wave representation using complex exponential term](./complex-rotation.gif)
Source: https://tutorial.math.lamar.edu/Extras/ComplexPrimer/Forms.aspx

To be able to separate the function based on each waves' frequency, Fourier transform attempt to isolate the amplitude and the phase. The magic comes from taking the integral of the product of the exponential term and the input signal $f(t)$. The product of them represent the contribution of the frequency component at frequency $\omega$ to the original signal $f(t)$. The idea is, we need to find out how much of the signal at time $t$ is contributed by the frequency component at frequency $\omega$. Do this for all $t$ to know the product for all time domain. This is where integral comes to play. Essentially, taking the integral for all values of $t$ measures the amount of overlap between the original signal and the oscillating function at frequency $\omega$.
Multiplying the original signal $f(t)$ with the exponential term would give us a number that represent the correlation between them, for which we know its contribution to the input wave frequency.

A product represents the contribution of the frequency component at frequency $\omega$ to the original signal $f(t)$. In order to know the contribution of the whole signal function, we can multiply the signal over time. This is where integral comes to play. Essentially, taking the integral for all values of $t$ measures the amount of overlap between the original signal and the oscillating function at frequency $\omega$.

Taking the integral produces the $F(\omega)$ function, which is a complex-valued function that will take frequency $\omega$ and shows the amplitude and phase of each frequency component present in $f(t)$.
All this produces the $F(\omega)$ function, which is a complex-valued function that will take frequency $\omega$ and shows the amplitude and phase of each frequency component present in $f(t)$.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Convolution of two function $f(t)$ and $g(t)$ is defined as follows:
![Convolution formula with function of time involving integral](./convolution-formula.png)

- $\ast$ is the convolution operator
- $\tau$ is just a placeholder variable
- $\tau$ is just a placeholder variable.

The formula represents the infinite sum (integration) of the product between two function at different time delays. When we multiply two function at different time delays, we are essentially adding together the waves of the two signals at different frequencies.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,39 @@ title: Discrete Fourier Transform
description: Discrete Fourier Transform
---

**Main Source : Various source from Google and Youtube**
**Main Source:**

**Discrete Fourier Transform (DFT)** is the version of the Fourier Transform for discrete periodic signal. DFT is widely used in digital signal processing because computers can only process discrete signals. With DFT, we can Fourier transform digital signal such as audio to filter out signal to remove noises or some specific frequencies.
- **Various source from Google and YouTube**

![Fourier transform with continous signal compared to Discrete Fourier transform with discrete signal](./dft-comparison.png)
Source : https://www.ee-diary.com/2023/05/what-is-discrete-fourier-transformdft.html#
**Discrete Fourier transform (DFT)** is the discrete signal version of the [Fourier transform](/digital-signal-processing/fourier-transform). DFT is widely used in digital signal processing because computers can only process discrete signals. One application of DFT is removing noises or filtering specific frequencies from digital signal.

### How does it works
![Discrete Fourier transform of digital signal compared to Fourier transform of continuous signal](./dft-comparison.png)
Source: https://www.ee-diary.com/2023/05/what-is-discrete-fourier-transformdft.html#

Here is the formula for DFT :
### How does it work

The formula for DFT is:

![DFT Formula](./dft-formula.png)

- $n$ : Sample index
- $N$ : Number of samples
- $k$ : Frequency bin index
- $X(k)$ : The k-th frequency component of the signal
- $x(n)$ : The n-th sample of the input sequence
- $j$ : The imaginary unit
- $e^{-j2 \pi k n / N}$ : The exponential term involving $2\pi k n /N$ to convert frequency from cycles per second to radians per sample
- $n$: Sample index
- $N$: Number of samples
- $k$: Frequency bin index
- $X(k)$: The k-th frequency component of the signal
- $x(n)$: The n-th sample of the input sequence
- $j$: The imaginary unit
- $e^{-j2 \pi k n / N}$: The exponential term involving $2\pi k n /N$ to convert frequency from cycles per second to radians per sample.

A discrete signal is made from sampling a continous signal. Sampling process involves taking a sequence of equally spaced samples of the continuous signal. The samples is typically called N and the number of samples must be an integer power of 2.
A discrete signal is made by [sampling](/digital-signal-processing/sampling) a continuous signal. The sampling process takes a sequence of equally spaced point of the continuous signal. The number of sample is called $N$ and the number of samples must be an integer power of 2.

FT and DFT is kinda similar, they differs in how we multiply with the complex exponential term.
In FT, we multiply by $f(t)$ which is the function of signal. While in DFT, we multiply by each of the sample.
In FT, we multiply the exponential term (representation of sine and cosine waves) with $f(t)$, the signal function. While in DFT, the signal function is replaced by the n-th sample $x(n)$, which increase up to the number of sample $N$. The sample is represented as complex-number vector.

After multiplying by each sample, the resulting product is a complex number that represents the contribution of that sample to the k-th frequency component of the signal in the frequency domain. It has a magnitude and a phase angle that depend on the value of the sample $x(n)$ and the frequency bin index k.
The resulting product is a complex number that represents the contribution of that specific sample to the k-th frequency component of the signal in the frequency domain. It has a magnitude and a phase angle that depend on the value of the sample $x(n)$ and the frequency bin index $k$.

### Computation
#### Computation

FT is a continuous-time transform that involves integration over an infinite time interval. Its computation is typically performed using numerical integration techniques. FT can be computationally expensive for large bandwidth or a complex frequency structure.

In computation, DFT multiplication between input signal and exponential term is typically represented in matrix multiplication. With a straight forward algorithm, DFT can be computed in $O(N^2)$ time, where N is the number of samples in the signal.
In DFT, with input signal and the exponential term being represented in vector, the multiplication between them result in a matrix multiplication. With a straightforward algorithm, DFT can be computed in $O(N^2)$ time, where $N$ is the number of samples in the signal.

There is also an improvement for DFT algorithm which is the [Fast Fourier Transform (FFT) algorithm](/digital-signal-processing/fast-fourier-transform).
Next topic is an improvement for DFT algorithm which is the [Fast Fourier transform (FFT) algorithm](/digital-signal-processing/fast-fourier-transform).
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,40 @@ title: Fast Fourier Transform
description: Fast Fourier Transform
---

**Main Source : Various source from Google and Youtube**
**Main Source:**

**Fast Fourier Transform (FFT)** algorithm is a fast and efficient algorithm for computing the Discrete Fourier Transform (DFT) of a sequence of N complex numbers. FFT is able to make improvement from an $O(N^2)$ algorithm to an $O(N \: log (N))$.
- **Various source from Google and YouTube**

### How does it works
**Fast Fourier transform (FFT)** algorithm is a fast and efficient algorithm for computing the [Discrete Fourier transform (DFT)](/digital-signal-processing/discrete-fourier-transform) of a sequence of $N$ complex numbers. FFT improves a quadratic complexity $O(N^2)$ algorithm to a linearithmic $O(N \: log (N))$ speed.

There are some version of FFT developed over time, the most common version is the radix-2 which was originally described by Cooley-Tukey in 1965.
:::tip
More about [algorithm complexity](/data-structures-and-algorithms/analysis-of-algorithms#big-o-notation).
:::

### How does it work

There are few versions of FFT developed over time, the most common version is the radix-2 version which was originally described by Cooley-Tukey in 1965.

#### DFT Properties

DFT has some properties due to the nature of wave.

The symmetry properties states that if the input signal is real and even (symmetric), then the output will also be real and even (symmetric).
Similarly, if the input signal is real and odd (antisymmetric), then the output will be imaginary and odd (antisymmetric).

On the other hand, the periodicity properties states that the output of DFT will repeat after a certain number of samples.
- **Symmetry**: When the input signal is real and even (symmetric), then the output will also be real and even (symmetric). Similarly, if the input signal is real and odd (antisymmetric), then the output will be imaginary and odd (antisymmetric).
- **Periodicity**: Periodicity property states that the output of DFT will repeat after a certain number of samples.

Using these properties, we can use it to perform a more efficient computation.

### The idea
#### The Idea

The basic idea of FFT algorithm is to use divide-and-conquer algorithm strategy. FFT divides problem into smaller subproblems and solve it recursively. This can make computation more efficient because DFT has those properties.
The periodicity property can help reduce computation. Knowing that the output repeats at certain points allows us to avoid calculating samples outside that period. This makes us able to decompose the whole calculation into smaller calculation.

The periodicity means that the output is periodic, this makes us able to decompose it to smaller calculation. If we have period of N, then we can divide it by N. And with the symmetry properties, we only need to calculate the first half of DFT output and the second half can be obtained by symmetry.
With the symmetry properties, we know that the second half of the signal is related to the first half, this allows us to derive the FFT result of the second half from the result of the first half.

For example, if signal has the same output 8 times, we can divide it by 8. For each period, if signal is real-valued, then only the first half of the DFT need to be computed, because the second half of the coefficients can be obtained by symmetry.
For example, if a signal has period of 8 (meaning it repeat every 8 samples), we can divide it to 8 calculation. Then, for each period, only the first half of the DFT need to be computed, because the second half of the coefficients can be obtained by symmetrical property.

![DFT algorithm with divide-and-conquer approach](./fft-example.png)
Source : https://towardsdatascience.com/fast-fourier-transform-937926e591cb

After dividing into sub problems, each computation of the sub problem is the original matrix multiplication.
So in summary, FFT provides a significant improvement over original DFT by using its properties and the nature of wave.

### FFT Output

A signal can have a various frequency in different time, using FFT we can split all the wave based on their frequency. The x-axis of FFT output shows the frequency bin or the frequency group. The y-axis represent the magnitude of corresponding frequency. Magnitude means how strong or how significant is the contribution of that wave.

For example, if in the x-axis = 100 there is a peak or high magnitude, this means that the wave with frequency 100Hz contribute the most to the original signal.

With the information from the FFT output, we can filter out the signal. For example, we can remove noise or unwanted signals by identifying high magnitudes in the output. If the majority of the output magnitudes range from 0 to 20, but there is one frequency with a magnitude of 100, a simple filter can be used to eliminate the infrequent magnitude.

A high magnitude or peak in the output can be interpreted as a wave that contribute the most or a noise which is unwanted signal. Because of this, a further analysis such as spectral shape, examining the relative magnitudes of different peaks are used to distinguish.
Source: https://towardsdatascience.com/fast-fourier-transform-937926e591cb

![Fourier transform output](./fft-output.png)
Source : https://learn.adafruit.com/fft-fun-with-fourier-transforms/background
:::info
FFT algorithm use the [divide-and-conquer algorithm strategy](/data-structures-and-algorithms/divide-and-conquer). FFT divides problem into smaller subproblems and solve it recursively, which makes computation more efficient.
:::
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 92c5723

Please sign in to comment.