sokobo
Loading...
Searching...
No Matches
fourier.h
1#include "complex_number.h"
2#include <vector>
3#include <functional>
4
6public:
7 // Discrete Fourier Transform
8 static std::vector<ComplexNumber> DFT(const std::vector<ComplexNumber>& signal);
9 static std::vector<ComplexNumber> IDFT(const std::vector<ComplexNumber>& spectrum);
10
11 // Fast Fourier Transform
12 static std::vector<ComplexNumber> FFT(const std::vector<ComplexNumber>& signal);
13 static std::vector<ComplexNumber> IFFT(const std::vector<ComplexNumber>& spectrum);
14
15 // Continuous Fourier Transform (numerical)
16 static ComplexNumber continuousFT(std::function<double(double)> f, double omega, double T = 10.0);
17 static std::function<double(double)> inverseFT(std::function<ComplexNumber(double)> F, double t_max = 10.0);
18
19 // Fourier Series
20 static std::vector<ComplexNumber> fourierSeries(std::function<double(double)> f, double period, int harmonics);
21
22 // Spectral analysis
23 static std::vector<double> powerSpectrum(const std::vector<double>& signal);
24 static std::vector<double> magnitude(const std::vector<ComplexNumber>& spectrum);
25 static std::vector<double> phase(const std::vector<ComplexNumber>& spectrum);
26
27 // Window functions
28 static std::vector<double> hammingWindow(int N);
29 static std::vector<double> hanningWindow(int N);
30 static std::vector<double> blackmanWindow(int N);
31};