@Test public void testInterpolatedBtwArrayRange() { double upperBound = SpikeInterpolation.interBetween(91, 210, 15, 14, 14.5); assertEquals(150.5, upperBound, 1e-2); double lowerBound = SpikeInterpolation.interBetween(162, 95, 15, 14, 14.5); assertEquals(128.5, lowerBound, 1e-2); double v = SpikeInterpolation.interBetween(lowerBound, upperBound, 20, 21, 20.2); assertEquals(146.1, v, 1e-2); }
static double interBetween(double lowerY, double upperY, double upperX, double lowerX, double position) { if (upperX - lowerX == 0) { return lowerY; } return lowerY + ((upperY - lowerY) * (position - lowerX)) / (upperX - lowerX); }
SpikeInterpolation { static double interBetween(double lowerY, double upperY, double upperX, double lowerX, double position) { if (upperX - lowerX == 0) { return lowerY; } return lowerY + ((upperY - lowerY) * (position - lowerX)) / (upperX - lowerX); } }
SpikeInterpolation { static double interBetween(double lowerY, double upperY, double upperX, double lowerX, double position) { if (upperX - lowerX == 0) { return lowerY; } return lowerY + ((upperY - lowerY) * (position - lowerX)) / (upperX - lowerX); }  }
SpikeInterpolation { static double interBetween(double lowerY, double upperY, double upperX, double lowerX, double position) { if (upperX - lowerX == 0) { return lowerY; } return lowerY + ((upperY - lowerY) * (position - lowerX)) / (upperX - lowerX); }   }
SpikeInterpolation { static double interBetween(double lowerY, double upperY, double upperX, double lowerX, double position) { if (upperX - lowerX == 0) { return lowerY; } return lowerY + ((upperY - lowerY) * (position - lowerX)) / (upperX - lowerX); }    }