From e9140652d1c9236f55232deff152933712926dd4 Mon Sep 17 00:00:00 2001 From: teajay Date: Mon, 13 Jul 2020 16:19:36 +0200 Subject: [PATCH] repariert --- abgabe6.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/abgabe6.cpp b/abgabe6.cpp index 7b16682..39ff8f8 100644 --- a/abgabe6.cpp +++ b/abgabe6.cpp @@ -16,7 +16,7 @@ using namespace std; typedef struct { long n; double b, a, beta, alpha; - double tmin, tmax,h,tl; + double tmin, tmax,h,tl,signalLenght; int m; int sign; } fft_param; @@ -184,7 +184,8 @@ vector> makeS(fft_param *fp){ vector> s(n); //Vektor zum speichern von s for(int k=0;k= 0 && t-tl <= tmax){ + //TODO s ist nicht geschiftet + if (t >= 0 && t <= fp->signalLenght){ s[k]=sin(2*M_PI*alpha*(t-tl)); //s berechnen } @@ -201,16 +202,22 @@ vector> makeE(fft_param *fp){ double tmin=fp->tmin; double t; double beta=fp->beta; + double alpha=fp->alpha; double tl=fp->tl; double a=fp->a; double b=fp->b; int n=fp->n; vector> e(n); //Vektor zum speichern von e - vector> s=makeS(fp); //Vektor s wird benötigt + //vector> s=makeS(fp); //Vektor s wird benötigt //FILE *fp3 = fopen("H10_2_30.txt" ,"w"); for(int k=0;k= 0 && t-tl <= fp->signalLenght){ + e[k]+=sin(2*M_PI*alpha*(t-tl)); //s berechnen + + } //fprintf(fp3,"%f\t%f\n",t,pow(e[k].real(),2)); //printf("%f\t%f\n",t,pow(e[k].real(),2)); //printf("%f\t%f\t%f\n",t,e[k].real(),e[k].imag()); @@ -239,6 +246,12 @@ vector> aufgabe3 (fft_param *fp){ fft_param fps=*fp; //Sign im struct ändern fps.sign=-1; vector> FFFes=fourierTrafo(&fps, FFes); //Rücktransformation des Produkts + + FILE *fpPlot =fopen("esPlot.csv","w"); + for(int k = 0; k> es = aufgabe3(fp); FILE *fp4 =fopen("es4.csv","w"); for (int k=0;k