Presentation is loading. Please wait.

Presentation is loading. Please wait.

Interpolation. A method of constructing a function that crosses through a discrete set of known data points.

Similar presentations


Presentation on theme: "Interpolation. A method of constructing a function that crosses through a discrete set of known data points."— Presentation transcript:

1 Interpolation. A method of constructing a function that crosses through a discrete set of known data points.

2 Spline Interpolation Linear, Quadratic, Cubic Preferred over other polynomial interpolation More efficient High-degree polynomials are very computationally expensive Smaller error Interpolant is smoother

3 Spline Interpolation Definition Given n+1 distinct knots x i such that: with n+1 knot values y i find a spline function with each S i (x) a polynomial of degree at most n.

4 Linear Spline Interpolation Simplest form of spline interpolation Points connected by lines Each S i is a linear function constructed as: Must be continuous at each data point: Continuity:

5 Quadratic Spline Interpolation The quadratic spline can be constructed as: The coefficients can be found by choosing a z 0 and then using the recurrence relation:

6 Quadratic Splines 2 Quadratic splines are rarely used for interpolation for practical purposes Ideally quadratic splines are only used to understand cubic splines

7 Quadratic Spline Graph t=a:2:b;

8 Quadratic Spline Graph t=a:0.5:b;

9 Natural Cubic Spline Interpolation The domain of S is an interval [a,b]. S, S’, S’’ are all continuous functions on [a,b]. There are points t i (the knots of S) such that a = t 0 < t 1 <.. t n = b and such that S is a polynomial of degree at most k on each subinterval [t i, t i+1 ]. SPLINE OF DEGREE k = 3 ynyn …y1y1 y0y0 y tntn …t1t1 t0t0 x t i are knots

10 Natural Cubic Spline Interpolation S i (x) is a cubic polynomial that will be used on the subinterval [ x i, x i+1 ].

11 Natural Cubic Spline Interpolation S i (x) = a i x 3 + b i x 2 + c i x + d i 4 Coefficients with n subintervals = 4n equations There are 4 n-2 conditions Interpolation conditions Continuity conditions Natural Conditions S’’(x 0 ) = 0 S’’(x n ) = 0

12 Natural Cubic Spline Interpolation Algorithm Define Z i = S’’(t i ) On each [t i, t i+1 ] S’’ is a linear polynomial with S i ’’(t i ) = z i, S i ’’ (t i+1 ) = z+1 Then Where h i = t i+1 – t i Integrating twice yields:

13 Natural Cubic Spline Interpolation Where h i = x i+1 - x i S’ i-1 (t i ) = S’ i (t i ) Continuity Solve this by deriving the above equation

14 Natural Cubic Spline Interpolation Algorithm: Input: t i, y i h i = t i+1 – t i a u i = 2(h i-1 + h i ) v i = 6(b i – b i-1 ) Solve Az = b

15 Hand spline interpolation

16 Bezier Spline Interpolation A similar but different problem: Controlling the shape of curves. Problem: given some (control) points, produce and modify the shape of a curve passing through the first and last point.

17 Bezier Spline Interpolation Practical Application

18 Bezier Spline Interpolation Idea: Build functions that are combinations of some basic and simpler functions. Basic functions: B-splines Bernstein polynomials

19 Bernstein Polynomials Definition 5.5: Bernstein polynomials of degree N are defined by: For v = 0, 1, 2, …, N, where N over v = N! / v! (N – v)! In general there are N+1 Bernstein Polynomials of degree N. For example, the Bernstein Polynomials of degrees 1, 2, and 3 are: 1. B 0,1 (t) = 1-t, B 1,1 (t) = t; 2. B 0,2 (t) = (1-t) 2, B 1,2 (t) = 2t(1-t), B 2,2 (t) = t 2 ; 3. B 0,3 (t) = (1-t) 3, B 1,3 (t) = 3t(1-t) 2, B 2,3 (t)=3t 2 (1-t), B 3,3 (t) = t 3 ;

20 Bernstein Polynomials Given a set of control points {P i } N i=0, where P i = (x i, y i ), Definition 5.6: A Bezier curve of degree N is: P(t) = N i=0 P i B i,N (t), Where Bi,N(t), for I = 0, 1, …, N, are the Bernstein polynomials of degree N. P(t) is the Bezier curve Since P i = (x i, y i ) x(t) = N i=0 x i B i,N (t) and y(t) = N i=0 y i B i,N (t) Easy to modify curve if points are added.

21 Bernstein Polynomials Example Find the Bezier curve which has the control points (2,2), (1,1.5), (3.5,0), (4,1). Substituting the x- and y-coordinates of the control points and N=3 into the x(t) and y(t) formulas on the previous slide yields x(t) = 2B 0,3 (t) + 1B 1,3 (t) + 3.5B 2,3 (t) + 4B 3,3 (t) y(t) = 2B 0,3 (t) + 1.5B 1,3 (t) + 0B 2,3 (t) + 1B 3,3 (t)


Download ppt "Interpolation. A method of constructing a function that crosses through a discrete set of known data points."

Similar presentations


Ads by Google