Java Linear Interpolate linearInterpolation(double x0, double y0, double x1, double y1, double x)

Here you can find the source of linearInterpolation(double x0, double y0, double x1, double y1, double x)

Description

The linear interpolant is the straight line between these points

License

LGPL

Parameter

Parameter Description
x0 a parameter
y0 a parameter
x1 a parameter
y1 a parameter
x a parameter

Return

y

Declaration

public static double linearInterpolation(double x0, double y0,
        double x1, double y1, double x) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**//from   ww  w.  j a v  a 2  s  .  c  o  m
     * The linear interpolant is the straight line between these points
     * 
     * @param x0
     * @param y0
     * @param x1
     * @param y1
     * @param x
     * @return y
     */
    public static double linearInterpolation(double x0, double y0,
            double x1, double y1, double x) {
        return y0 + ((y1 - y0) / (x1 - x0)) * (x - x0);
    }
}

Related

  1. linearInterpolate(double v1, double v2, double amount)
  2. linearInterpolate(double[] x)
  3. linearInterpolate(float y1, float y2, float mu)
  4. linearInterpolation(double min, double max, double factor)
  5. linearInterpolation(double x, double x1, double x2, double y1, double y2)
  6. linearInterpolation(double y2, double y1, double deltaX, double x1)
  7. LinearInterpolation(float a, float b, float f)
  8. linearInterpolation(float min, float max, float min2, float max2, float value)
  9. linearInterpReal(double dX, double[] dXCoordinate, double[] dYCoordinate)