Java Linear Interpolate linearInterpolation(double y2, double y1, double deltaX, double x1)

Here you can find the source of linearInterpolation(double y2, double y1, double deltaX, double x1)

Description

Perform a linear interpolation calculation.

License

Open Source License

Parameter

Parameter Description
y2 the upper bound
y1 the lower bound
deltaX the delta x value
x1 the given x value

Return

the calculated y value at the position x1

Declaration

public static double linearInterpolation(double y2, double y1, double deltaX, double x1) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * <copyright> Copyright (c) 2014-2016 Bauhaus Luftfahrt e.V.. All rights reserved. This program and the accompanying
 * materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html </copyright>
 ******************************************************************************/

public class Main {
    /**/*from w  w w  .  j  a  v  a 2  s .c  om*/
     * Perform a linear interpolation calculation.
     *
     * @param y2
     *            the upper bound
     * @param y1
     *            the lower bound
     * @param deltaX
     *            the delta x value
     * @param x1
     *            the given x value
     * @return the calculated y value at the position x1
     */
    public static double linearInterpolation(double y2, double y1, double deltaX, double x1) {
        return y2 - (y2 - y1) / deltaX * x1;
    }
}

Related

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