Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computers in Civil Engineering 53:081 Spring 2003 Lecture #15 Spline Interpolation.

Similar presentations


Presentation on theme: "Computers in Civil Engineering 53:081 Spring 2003 Lecture #15 Spline Interpolation."— Presentation transcript:

1 Computers in Civil Engineering 53:081 Spring 2003 Lecture #15 Spline Interpolation

2 Newton Interpolation Problem In some cases Newton Interpolation (while going through all the data points) gives problematic results because of round-off errors and overshoot. This happens in the vicinity of an abrupt change. Simple, low order, piecewise polynomials (splines) give better results. Linear splines

3 Spline Concept Use low order (most often 3rd order), piecewise polynomials

4 Origin of Term Spline

5 Main drawback: lack of smoothness or, discontinuous derivatives – but it’s the best you can do with piecewise linear! Linear Splines

6 Linear Spline Interpolation

7 If we require that the m th order derivatives to be smooth, m+1 order spline must be used. For n+1 data points there are n intervals involved, thus, there are 3n coefficients to evaluate. Thus, 3n conditions are required. Quadratic Splines Quadratic (second order) splines, have first derivative continuous at knots.

8 Conditions Required I.The function values must be equal at the interior points ( 2n-2 conditions) II.The first and last functions must pass through the end points ( 2 conditions) III.The first derivatives at the interior points must be equal ( n-1 conditions) IV.Assume that the second derivative is zero at the first point ( 1 condition)

9 Quadratic Splines: Condition I The function values must be equal at the interior points ( 2n-2 conditions)

10 Quadratic Splines: Condition II The first and last functions must pass through the end points ( 2 conditions)

11 The first derivatives at the interior points must be equal ( n-1 conditions) Quadratic Splines: Condition III

12 Quadratic Splines Condition IV Assume that the second derivative is zero at the first point ( 1 condition) The first 2 points will be connected with a straight line.

13 Quadratic Splines The 3n unknowns can be obtained by solving a system of linear equations ( 3n by 3n ) See example 18.9 in the textbook for a worked example. 1(a) 3 2(a) 4 1(b) 2(b)

14 Cubic Splines

15 For n+1 data points, there are 4n unknowns to evaluate. Thus, 4n conditions are required: General form: I.The function values must be equal at the interior points ( 2n-2 conditions) II.The first and last functions must pass through the end points ( 2 conditions) III.The first derivatives at the interior points must be equal ( n-1 conditions) IV.The second derivatives at the interior points must be equal ( n-1 conditions) V.The second derivatives at the end points are zero (2 conditions)

16 Cubic Splines Solve 4n by 4n system of linear equations Solve n-1 by n-1 system of linear equations (derived using Lagrange polynomials) Two methods of solving for the unknown coefficients:

17 MATLAB Splines yy=spline(x,y,xx) Two functions for one-dimensional interpolation SPLINE: y=interp1(x,y,xi,’nearest’) INTERP1: y=interp1(x,y,xi,’linear’) y=interp1(x,y,xi,’spline’) y=interp1(x,y,xi,’cubic’)

18 Next: Numerical Integration


Download ppt "Computers in Civil Engineering 53:081 Spring 2003 Lecture #15 Spline Interpolation."

Similar presentations


Ads by Google