Quadratic Interpolation


The three t,y pairs satisfy the quadratic equations:

y0 = α t02 + β t0 + γ
y1 = α t12 + β t1 + γ
y2 = α t22 + β t2 + γ

To simplify the derivation, make a change of variables: x = t - t1

x0 = t0 - t1
x1 = t1 - t1 = 0
x2 = t2 - t1

Then the quadratic equations, in terms of x, are:

y0 = a x02 + b x0 + c
y1 = c
y2 = a x22 + b x2 + c

So now we know c = y1.

After solving for a and b, the peak can be found as the point where the slope of the quadratic y = a x2 + b x + c is zero, i.e. dy/dx = 2 a x + b = 0 for x = -b/(2a).

Multiply the first equation by x2, multiply the third equation by x0, and subtract:

  x2 (y0 = a x02 + b x0 + y1)
- x0 (y2 = a x22 + b x2 + y1)

x2 y0 - x0 y2 = a x02 x2 + y1 x2 - a x22 x0 - y1 x0

Solve for a:

a = ( x2 y0 - x0 y2 - y1 x2 + y1 x0 ) / ( x02 x2 - x22 x0 )

  = ( x2 ( y0 - y1 ) + x0 ( y1 - y2 ) ) / ( x0 x2 ( x0 - x2 ) )

Now use a and c (y1) to solve for b:

y0 = a x02 + b x0 + y1

b = (y0 - y1 - a x02) / x0

In terms of x, the peak is at:

x = -b/(2a)

y = a x2 + b x + y1

In terms of t, the peak is at:

t = t1 - b/(2a)