Results 1 to 3 of 3

Math Help - Linear Interpolation Question

  1. #1
    Newbie
    Joined
    Mar 2009
    Posts
    2

    Linear Interpolation Question

    Hello:
    The formula: y1 * (1-x) + y2 * x is a Linear Interpolation formula. I am trying to understand if this formula will yield the middle values between two points such as: Point 1: (5,10 ) and Point 2: (20,15)

    Would this be the diagonal line connecting these two points. If so, is "x" the range value from x1 to x2?. I am trying to code this in a computer function to test.

    Thanks in advance

    Mark
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Grandad's Avatar
    Joined
    Dec 2008
    From
    South Coast of England
    Posts
    2,570
    Thanks
    1

    Linear interpolation

    Hello mhartman

    Welcome to Math Help Forum!
    Quote Originally Posted by mhartman View Post
    Hello:
    The formula: y1 * (1-x) + y2 * x is a Linear Interpolation formula. I am trying to understand if this formula will yield the middle values between two points such as: Point 1: (5,10 ) and Point 2: (20,15)

    Would this be the diagonal line connecting these two points. If so, is "x" the range value from x1 to x2?. I am trying to code this in a computer function to test.

    Thanks in advance

    Mark
    I'm not sure where the formula you quote comes from, but this may help.

    The midpoint of the line joining the points (x_1,y_1) and (x_2, y_2) is

    \Big(\frac{x_1+x_2}{2}, \frac{y_1+y_2}{2}\Big)

    So in the example you quote, it will be \Big(\frac{5+20}{2}, \frac{10+15}{2}\Big) = (12.5, 12.5).

    The equation of the line joining these points is:

    \frac{y-y_1}{y_2-y_1}=\frac{x-x_1}{x_2-x_1}

    which can be re-arranged as:

    y = y_1 + (x-x_1)\frac{y_2-y_1}{x_2-x_1}

    which gives you the linear interpolation formula that will calculate the value of y for any value of x in the interval (x_1, x_2). So, for example, in the interval you quote, if you want the value of y when x = 13, it's

    y = 10 + (13-5)\frac{15-10}{20-5} = 10 + 8\times\frac{1}{3}= 12\tfrac23

    Grandad
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Mar 2009
    Posts
    2
    Thank you so much for taking the time to reply.

    Mark
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. linear interpolation
    Posted in the Statistics Forum
    Replies: 0
    Last Post: December 12th 2010, 10:51 AM
  2. Linear interpolation
    Posted in the Algebra Forum
    Replies: 10
    Last Post: November 17th 2010, 02:21 AM
  3. Linear interpolation
    Posted in the Advanced Math Topics Forum
    Replies: 1
    Last Post: November 9th 2009, 05:26 AM
  4. linear interpolation
    Posted in the Advanced Algebra Forum
    Replies: 1
    Last Post: February 19th 2009, 07:57 AM
  5. Linear interpolation
    Posted in the Calculus Forum
    Replies: 1
    Last Post: December 13th 2008, 09:49 AM

Search Tags


/mathhelpforum @mathhelpforum