correct fft scaling at Nyquist freq. in fft cmd and vector operation
This commit is contained in:
parent
5e82b63f62
commit
d2b1ecbb23
|
|
@ -181,10 +181,12 @@ com_fft(wordlist *wl)
|
||||||
scale = (double) fpts - 1.0;
|
scale = (double) fpts - 1.0;
|
||||||
fdvec[i][0].cx_real = out[0][0]/scale/2.0;
|
fdvec[i][0].cx_real = out[0][0]/scale/2.0;
|
||||||
fdvec[i][0].cx_imag = 0.0;
|
fdvec[i][0].cx_imag = 0.0;
|
||||||
for (j = 1; j < fpts; j++) {
|
for (j = 1; j < fpts-1; j++) {
|
||||||
fdvec[i][j].cx_real = out[j][0]/scale;
|
fdvec[i][j].cx_real = out[j][0]/scale;
|
||||||
fdvec[i][j].cx_imag = out[j][1]/scale;
|
fdvec[i][j].cx_imag = out[j][1]/scale;
|
||||||
}
|
}
|
||||||
|
fdvec[i][fpts-1].cx_real = out[fpts-1][0]/scale/2.0;
|
||||||
|
fdvec[i][fpts-1].cx_imag = 0.0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -777,10 +777,12 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp
|
||||||
scale = (double) fpts - 1.0;
|
scale = (double) fpts - 1.0;
|
||||||
outdata[0].cx_real = out[0][0]/scale/2.0;
|
outdata[0].cx_real = out[0][0]/scale/2.0;
|
||||||
outdata[0].cx_imag = 0.0;
|
outdata[0].cx_imag = 0.0;
|
||||||
for (i = 1; i < fpts; i++) {
|
for (i = 1; i < fpts-1; i++) {
|
||||||
outdata[i].cx_real = out[i][0]/scale;
|
outdata[i].cx_real = out[i][0]/scale;
|
||||||
outdata[i].cx_imag = out[i][1]/scale;
|
outdata[i].cx_imag = out[i][1]/scale;
|
||||||
}
|
}
|
||||||
|
outdata[fpts-1].cx_real = out[fpts-1][0]/scale/2.0;
|
||||||
|
outdata[fpts-1].cx_imag = 0.0;
|
||||||
|
|
||||||
fftw_free(ind);
|
fftw_free(ind);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue