diff options
author | Jamie Bullock <jamie@jamiebullock.com> | 2013-06-19 16:22:47 -0700 |
---|---|---|
committer | Jamie Bullock <jamie@jamiebullock.com> | 2013-06-19 16:23:51 -0700 |
commit | 03eb9cf0800c26c48e0369158f7058d3ae555fde (patch) | |
tree | 30288ac9c227a93e577aa8b2c47501dce07c2011 /src | |
parent | c82d51592e1d75fd87b677b27a836089c1d0e47c (diff) | |
download | LibXtract-03eb9cf0800c26c48e0369158f7058d3ae555fde.tar.gz LibXtract-03eb9cf0800c26c48e0369158f7058d3ae555fde.tar.bz2 LibXtract-03eb9cf0800c26c48e0369158f7058d3ae555fde.zip |
Offset peak interpolation by one spectral bin. Fixes #20
Diffstat (limited to 'src')
-rw-r--r-- | src/vector.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 { |