changeset 180:e678a849f251

Offset peak interpolation by one spectral bin. Fixes #20
author Jamie Bullock <jamie@jamiebullock.com>
date Wed, 19 Jun 2013 16:22:47 -0700
parents 4d6483986506
children 17577ad7d584
files src/vector.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/vector.c	Wed Jun 19 16:05:59 2013 -0700
+++ b/src/vector.c	Wed Jun 19 16:22:47 2013 -0700
@@ -520,10 +520,11 @@
         {
             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
             {