Fourier transform: Difference between revisions
Line 24: | Line 24: | ||
<math display="block">a_m = \frac{1}{n} \sum_{k=0}^{n-1} \hat{f}(\xi) \exp \left\{ 2 \pi i \frac{mk}{n} \right\}</math> | <math display="block">a_m = \frac{1}{n} \sum_{k=0}^{n-1} \hat{f}(\xi) \exp \left\{ 2 \pi i \frac{mk}{n} \right\}</math> | ||
That the main | That the main difference between the FFT and IFFT is the negative symbol in the exponent. | ||
You can implement IFFT as <code>IFFT(x) = (1/len(x))*conj(FFT(conj(x)))</code><ref name="siembida2010ifft"></ref>. | You can implement IFFT as <code>IFFT(x) = (1/len(x))*conj(FFT(conj(x)))</code><ref name="siembida2010ifft"></ref>. | ||
Revision as of 15:16, 24 January 2023
The Fourier transform decomposes a signal (i.e. a time series) into multiple sine and cosine waves.
Background
Suppose we have signal\(\displaystyle f(x)\).
Then the Fourier transform \(\displaystyle \hat{f}(\xi)\)is defined as:
\[\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-i2 \pi \xi x} dx\]
Recall that Euler's formula states: \(\displaystyle e^{ix} = cos(x) + i \sin(x)\). Hence, \(\displaystyle e^{-i2 \pi \xi x} = cos(-2 \pi \xi x) + i \sin(-2 \pi \xi x)\) In other words, the Fourier transform is the integral (i.e. alignment) of signal times some sine and cosine waves.
The inverse of the fourier transform is: \[f(x) = \int_{-\infty}^{\infty} \hat{f}(\xi) e^{i2 \pi \xi x} d\xi\]
Discrete Fourier Transform
A naive DFT would compute the matrix of \(\displaystyle e^{-i2 \pi \xi x}\) and multiply it with the signal. This would take \(\displaystyle \mathcal{O}(n^2)\) time.
However, most languages have an FFT library which can compute the DFT in \(\displaystyle \mathcal{O}(n \log n)\) time.
In most languages, FFT is defined as: \[A_k = \sum_{m=0}^{n-1} f(x) \exp\ \left\{ -2 \pi i \frac{mk}{n} \right\}\] and IFFT is defined as: \[a_m = \frac{1}{n} \sum_{k=0}^{n-1} \hat{f}(\xi) \exp \left\{ 2 \pi i \frac{mk}{n} \right\}\]
That the main difference between the FFT and IFFT is the negative symbol in the exponent.
You can implement IFFT as IFFT(x) = (1/len(x))*conj(FFT(conj(x)))
[1].
Properties
Note \(\displaystyle \bar{x}\) refers to the complex conjugate
- Linearity: \(\displaystyle FFT(\lambda f + g) = \lambda FFT(f) + FFT(g)\)
- \(\displaystyle IFFT(f) = (1/n) \bar{FFT}(\bar{f})\)
- \(\displaystyle FFT2(f) = FFT_{x}(FFT_{y}(f)) = FFT_{y}(FFT_{x}(f))\)
Short-time Fourier transform
The STFT applies FFT using a sliding window over the signal.
This produces a matrix of FFT values over time which allow you to see how the signal is changing.
References
<templatestyles src="Reflist/styles.css" />
- ↑ Siembida, A. (2010, March 11). How to compute the IFFT using only the forward FFT. Adam Siembida Personal Webpage. Retrieved January 24, 2023, from https://adamsiembida.com/how-to-compute-the-ifft-using-only-the-forward-fft/