In this section, we are going to implement the Fourier transformation and its backward transformation and then play around with it to transform some signals:
- First, we include all the headers and declare that we use the std namespace:
#include <iostream> #include <complex> #include <vector> #include <algorithm> #include <iterator> #include <numeric> #include <valarray> #include <cmath> using namespace std;
- A data point of a signal is a complex number and shall be represented by std::complex, specialized on the double type. This way, the type alias cmplx stands for two coupled double values, which represent the real and the imaginary parts of a complex number. A whole signal is a vector of such items, which we alias to ...