Example code taken here (linear only):
public static final double[] interpLinear(double[] x, double[] y, double[] xi) throws IllegalArgumentException { if (x.length != y.length) { throw new IllegalArgumentException("X and Y must be the same length"); } if (x.length == 1) { throw new IllegalArgumentException("X must contain more than one value"); } double[] dx = new double[x.length - 1]; double[] dy = new double[x.length - 1]; double[] slope = new double[x.length - 1]; double[] intercept = new double[x.length - 1];
dgorissen
source share