Interpolation s

3
Linear interpolation y-y0 y1-y0 x-x0 x1-x0 y = y0 + (y1-y0)*(x-x0)/(x1-x0) Spline interpolation (a special type of piece A piecewise function is a function which is d Originally, spline was a term for elastic rul The curvature of a curve y = f(x) is k = [y"] / (1+[y']^2)^(3/2) As the spline will take a shape that minimize both [y'] and [y"] will be continuous everywh y'(i) = y'(i+1) y"(i) = y"(i+1) i = [1, n-1] This can only be achieved if polynomials of d The classical approach is to use polynomials Algorithm to find the interpolating cubic spl q = (1-t)y1 + ty2 + t(1-t)(a(1-t) + bt) t = (x-x1)/(x2-x1) a = k1(x2-x1)-(y2-y1) b = -k2(x2-x1)+(y2-y1) => q' and q" For x=x1 and x=x2 => q'(x1) = k1 and q'(x2) = and q"(x1) = 2*(b-2a)/(x2-x1)^2 q"(x2) = 2*(a-2b)/(x2-x1)^2 where k0 = q1'(x0) ki = qi'(xi) = q(i+1)'(xi) kn = qn'(xn) For the elastic rulers being the model for th and to the right of the right-most "knot" the In case of three points the values for a11 a12 0 a21 a22 a23 X 0 a32 a33 => qi = (1-t)y(i-1) + tyi + t(1-t)(ai(1-t) + bi ai = k(i-1)(xi-xi-1)-(yi-yi-1) b = -ki(xi-xi-1)+(yi-yi-1

description

Interpolation spline

Transcript of Interpolation s

Page 1: Interpolation s

Linear interpolation

y-y0 y1-y0x-x0 x1-x0

y = y0 + (y1-y0)*(x-x0)/(x1-x0)

Spline interpolation (a special type of piecewise polynomial)A piecewise function is a function which is defined by multiple sub functions, each sub function applying to a certain interval of the main function's domain (a sub-domain)Originally, spline was a term for elastic rulers that were bent to pass through a number of predefined points ("knots")

The curvature of a curve y = f(x) isk = [y"] / (1+[y']^2)^(3/2)

As the spline will take a shape that minimizes the bending (near knots)both [y'] and [y"] will be continuous everywhere. To achieve this one must have thaty'(i) = y'(i+1)y"(i) = y"(i+1) i = [1, n-1]This can only be achieved if polynomials of degree 3 or higher are used.The classical approach is to use polynomials of degree 3 — the case of cubic splines.

Algorithm to find the interpolating cubic spline

q = (1-t)y1 + ty2 + t(1-t)(a(1-t) + bt)t = (x-x1)/(x2-x1)a = k1(x2-x1)-(y2-y1)b = -k2(x2-x1)+(y2-y1)

=> q' and q"For x=x1 and x=x2 => q'(x1) = k1 and q'(x2) = k2andq"(x1) = 2*(b-2a)/(x2-x1)^2q"(x2) = 2*(a-2b)/(x2-x1)^2

where

k0 = q1'(x0)ki = qi'(xi) = q(i+1)'(xi)kn = qn'(xn)

For the elastic rulers being the model for the spline interpolation one has that to the left of the left-most "knot" and to the right of the right-most "knot" the ruler can move freely and will therefore take the form of a straight line with q = 0′′

In case of three points the values fora11 a12 0 k0a21 a22 a23 X k1 =

0 a32 a33 k2

=> qi = (1-t)y(i-1) + tyi + t(1-t)(ai(1-t) + bit)ai = k(i-1)(xi-xi-1)-(yi-yi-1)b = -ki(xi-xi-1)+(yi-yi-1)

Page 2: Interpolation s

A piecewise function is a function which is defined by multiple sub functions, each sub function applying to a certain interval of the main function's domain (a sub-domain)Originally, spline was a term for elastic rulers that were bent to pass through a number of predefined points ("knots")

both [y'] and [y"] will be continuous everywhere. To achieve this one must have that

The classical approach is to use polynomials of degree 3 — the case of cubic splines.

For the elastic rulers being the model for the spline interpolation one has that to the left of the left-most "knot" and to the right of the right-most "knot" the ruler can move freely and will therefore take the form of a straight line with q = 0′′

b1b2b3