diff --git a/src/frontend/com_fft.c b/src/frontend/com_fft.c index c61c89a6f..0e06c594f 100644 --- a/src/frontend/com_fft.c +++ b/src/frontend/com_fft.c @@ -355,11 +355,10 @@ com_psd(wordlist *wl) vec_new(f); freq = f->v_realdata; + for (i = 0; i < fpts; i++) #ifdef HAVE_LIBFFTW3 - for (i = 0; i <= fpts; i++) freq[i] = i*1./span; #else - for (i = 0; i <= fpts; i++) freq[i] = i*1./span*length/N; #endif @@ -449,7 +448,7 @@ com_psd(wordlist *wl) #endif printf("Total noise power up to Nyquist frequency %5.3e Hz:\n%e V^2 (or A^2), \nnoise voltage or current %e V (or A)\n", - freq[fpts], noipower, sqrt(noipower)); + freq[fpts-1], noipower, sqrt(noipower)); /* smoothing with rectangular window of width "smooth", plotting V/sqrt(Hz) or I/sqrt(Hz) */ @@ -473,7 +472,7 @@ com_psd(wordlist *wl) } for (j = fpts-hsmooth; j < fpts; j++) { sum = 0.; - for (jj = 0; jj < smooth; jj++) + for (jj = 0; jj < hsmooth; jj++) sum += fdvec[i][j-hsmooth+jj].cx_real; sum /= (fpts - j + hsmooth - 1); reald[j] = (sqrt(sum)/scaling); diff --git a/src/frontend/trannoise/1-f-code.c b/src/frontend/trannoise/1-f-code.c index 04b9148d0..f03da97de 100644 --- a/src/frontend/trannoise/1-f-code.c +++ b/src/frontend/trannoise/1-f-code.c @@ -37,7 +37,7 @@ f_alpha(int n_pts, int n_exp, double X[], double Q_d, double alpha) ha = alpha/2.0; // Q_d = sqrt(Q_d); /* find the deviation of the noise */ #ifdef HAVE_LIBFFTW3 - length = 2 * (n_pts/2 + 1); + length = n_pts + 2; #else length = n_pts; #endif