This commit is contained in:
2026-01-04 15:35:46 +01:00
commit f53b8768f8
70 changed files with 51910 additions and 0 deletions

30
P4/Fourier.cpp Executable file
View File

@@ -0,0 +1,30 @@
#define _USE_MATH_DEFINES
#include <math.h>
#include "Fourier.h"
using namespace std;
vector<CKomplex> fourier(vector<CKomplex> werte, int vz) {
int N = werte.size();
vector<CKomplex> ret;
for (int n = 0; n < N; n++) {
CKomplex v(0,0);
for (int k = 0; k < N; k++) {
double phi = (vz * -2.0 * M_PI * k * n) / (double) N;
CKomplex e = werte[k] * CKomplex(phi);
v = v + e;
}
v = v * (1 / sqrt(N));
ret.push_back(v);
}
return ret;
}
vector<CKomplex> Fourier::hin(vector<CKomplex> werte) {
return fourier(werte, -1);
}
vector<CKomplex> Fourier::zurueck(vector<CKomplex> werte) {
return fourier(werte, 1);
}