Revision 44:c5cd88de5809
| PeakInterpolator.cpp | ||
|---|---|---|
| 26 | 26 |
|
| 27 | 27 |
#include <iostream> |
| 28 | 28 |
|
| 29 |
static double cubicInterpolate(const double y[4], double x) |
|
| 30 |
{
|
|
| 31 |
double a0 = y[3] - y[2] - y[0] + y[1]; |
|
| 32 |
double a1 = y[0] - y[1] - a0; |
|
| 33 |
double a2 = y[2] - y[0]; |
|
| 34 |
double a3 = y[1]; |
|
| 35 |
return |
|
| 36 |
a0 * x * x * x + |
|
| 37 |
a1 * x * x + |
|
| 38 |
a2 * x + |
|
| 39 |
a3; |
|
| 40 |
} |
|
| 41 |
|
|
| 42 | 29 |
double |
| 43 | 30 |
PeakInterpolator::findPeakLocation(const double *data, int size) |
| 44 | 31 |
{
|
Also available in: Unified diff