Package adams.data
Class InterpolationUtils
- java.lang.Object
-
- adams.data.InterpolationUtils
-
public class InterpolationUtils extends Object
Helper class for interpolation.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description InterpolationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleinterpolate(double x, double xLeft, double yLeft, double xRight, double yRight)Interpolates the Y value for a given X and the surrounding x/y pairs.static doubleinterpolate(double x, double xLeft, double yLeft, double xRight, double yRight, double[] weights)Interpolates the Y value for a given X and the surrounding x/y pairs.static double[]weights(double x, double xLeft, double xRight)Calculates the interpolation weights for the left and right X.
-
-
-
Method Detail
-
weights
public static double[] weights(double x, double xLeft, double xRight)Calculates the interpolation weights for the left and right X.- Parameters:
x- the X to calculate the interpolation weightsxLeft- the X to the leftxRight- the X to the right- Returns:
- the weights (left=0, right=1)
-
interpolate
public static double interpolate(double x, double xLeft, double yLeft, double xRight, double yRight, double[] weights)Interpolates the Y value for a given X and the surrounding x/y pairs.- Parameters:
x- the X to generate the interpolated Y forxLeft- the X to the leftyLeft- the Y to the leftxRight- the X to the rightyRight- the Y to the rightweights- array of length 2 to store the weights in (left/right)- Returns:
- the interpolated Y
-
interpolate
public static double interpolate(double x, double xLeft, double yLeft, double xRight, double yRight)Interpolates the Y value for a given X and the surrounding x/y pairs.- Parameters:
x- the X to generate the interpolated Y forxLeft- the X to the leftyLeft- the Y to the leftxRight- the X to the rightyRight- the Y to the right- Returns:
- the interpolated Y
-
-