Mercurial > hg > libxtract
comparison src/vector.c @ 117:2b2d0609e44f
Fixed bug in peak interpolation algorithm in xtract_peak_spectrum()
author | Jamie Bullock <jamie@postlude.co.uk> |
---|---|
date | Sun, 04 May 2008 11:02:40 +0000 |
parents | 6c5ece9cba3a |
children | 75e14c9881ee |
comparison
equal
deleted
inserted
replaced
116:859495925633 | 117:2b2d0609e44f |
---|---|
434 result[N] = 0; | 434 result[N] = 0; |
435 | 435 |
436 for(n = 1; n < N; n++){ | 436 for(n = 1; n < N; n++){ |
437 if(input[n] >= threshold){ | 437 if(input[n] >= threshold){ |
438 if(input[n] > input[n - 1] && input[n] > input[n + 1]){ | 438 if(input[n] > input[n - 1] && input[n] > input[n + 1]){ |
439 result[N + n] = q * (n + (p = .5 * (y = input[n-1] - | 439 result[N + n] = q * (n + (p = .5 * ((y = input[n-1]) - |
440 (y3 = input[n+1])) / (input[n - 1] - 2 * | 440 (y3 = input[n+1])) / (input[n - 1] - 2 * |
441 (y2 = input[n]) + input[n + 1]))); | 441 (y2 = input[n]) + input[n + 1]))); |
442 result[n] = y2 - .25 * (y - y3) * p; | 442 result[n] = y2 - .25 * (y - y3) * p; |
443 } | 443 } |
444 else{ | 444 else{ |