com_psd: Correct the special handling of dc and nyquist component in fftw branch
This commit is contained in:
parent
2c0081e5c0
commit
0ef666ea26
|
|
@ -397,14 +397,19 @@ com_psd(wordlist *wl)
|
||||||
scaling = (double) length;
|
scaling = (double) length;
|
||||||
|
|
||||||
intres = (double)length * (double)length;
|
intres = (double)length * (double)length;
|
||||||
noipower = 0.0;
|
fdvec[i][0].cx_real = out[0][0]*out[0][0]/intres;
|
||||||
for (j = 0; j < fpts; j++) {
|
fdvec[i][0].cx_imag = 0;
|
||||||
|
noipower = fdvec[i][0].cx_real;
|
||||||
|
for (j = 1; j < fpts-1; j++) {
|
||||||
fdvec[i][j].cx_real = 2.* (out[j][0]*out[j][0] + out[j][1]*out[j][1])/intres;
|
fdvec[i][j].cx_real = 2.* (out[j][0]*out[j][0] + out[j][1]*out[j][1])/intres;
|
||||||
fdvec[i][j].cx_imag = 0;
|
fdvec[i][j].cx_imag = 0;
|
||||||
noipower += fdvec[i][j].cx_real;
|
noipower += fdvec[i][j].cx_real;
|
||||||
if (!finite(noipower))
|
if (!finite(noipower))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
fdvec[i][fpts-1].cx_real = out[fpts-1][0]*out[fpts-1][0]/intres;
|
||||||
|
fdvec[i][fpts-1].cx_imag = 0;
|
||||||
|
noipower += fdvec[i][fpts-1].cx_real;
|
||||||
|
|
||||||
#else /* Green's FFT */
|
#else /* Green's FFT */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue