54 int numberOfFragments = amplitude.size();
60 while (j < numberOfFragments) {
76 int numberOfSamplings = amplitude.size();
80 for (
int i = 0;
i < numberOfSamplings;
i++) {
81 if (amplitude[
i] >
max) {
88 if (maxIndex < 0 || maxIndex >= numberOfSamplings)
return charge;
93 else if (maxIndex == (numberOfSamplings - 1))
94 return amplitude[numberOfSamplings - 1];
97 double y1 = amplitude[maxIndex - 1];
98 double y2 = amplitude[maxIndex];
99 double y3 = amplitude[maxIndex + 1];
100 a = 0.5 * (y3 +
y1 - 2 *
y2);
106 double offset = (
a == 0) ? 0 : -
b / (2 *
a);