From 03eb9cf0800c26c48e0369158f7058d3ae555fde Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Wed, 19 Jun 2013 16:22:47 -0700 Subject: Offset peak interpolation by one spectral bin. Fixes #20 --- src/vector.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vector.c b/src/vector.c index ac42846..7da8576 100644 --- a/src/vector.c +++ b/src/vector.c @@ -520,10 +520,11 @@ int xtract_peak_spectrum(const double *data, const int N, const void *argv, doub { if(input[n] > input[n - 1] && n + 1 < N && input[n] > input[n + 1]) { - result[N + n] = q * (n + (p = .5 * ((y = input[n-1]) - + result[N + n] = q * (n + 1 + (p = .5 * ((y = input[n-1]) - (y3 = input[n+1])) / (input[n - 1] - 2 * (y2 = input[n]) + input[n + 1]))); result[n] = y2 - .25 * (y - y3) * p; + printf("result[%d] = %f\tresult[N+n] = %f\n", n, result[n], result[n+N]); } else { -- cgit v1.2.3