The Fourier transform (FT) is an integral transform that converts a function into a form that describes the frequencies present in the original function. The output of the transform is a complex-valued function of frequency. The term Fourier transform refers to both this complex-valued function and the mathematical operation. When a distinction needs to be made the Fourier transform is sometimes called the frequency domain representation of the original function. The Fourier transform is analogous to decomposing the sound of a musical chord into the intensities of its constituent pitches.
The Fourier transform (FT) is an analysis process, decomposing a complex-valued function
In the case of having discrete data, like a sequence of complex numbers, we need the Discrete Fourier Transform (DFT):
Note that the standard DFT has a time complexity of
- Split the complex numbers sequence into two subsequences, one with the even-indexed elements of the sequence and another one with the odd-indexed elements.
- Solve recursively the DFT's of both sequences and combine them together.
- Keep in mind that the DFT of a sequence of length one is just the same sequence.
#include <iostream>
#include "FourierTransform.h"
int main() {
using namespace std::complex_literals;
std::vector<std::complex<double>> sequence = {
1.0 + 2i, 2.5 - 2.5i, 3.2 + 5i, 4.8 + 0.5i
};
std::vector<std::complex<double>> transformedSequence = ft::DFT(sequence);
std::vector<std::complex<double>> invTransformedSequence = ft::IDFT(transformedSequence);
return 0;
}
#include <iostream>
#include "FourierTransform.h"
int main() {
using namespace std::complex_literals;
std::vector<std::complex<double>> sequence = {
1.0 + 2i, 2.5 - 2.5i, 3.2 + 5i, 4.8 + 0.5i
};
std::vector<std::complex<double>> transformedSequence = ft::FFT(sequence);
std::vector<std::complex<double>> invTransformedSequence = ft::IFFT(transformedSequence);
return 0;
}