spline interpolation a primer on the basics by don allen

22
Spline Interpolation A Primer on the Basics by Don Allen

Upload: vernon-bailey

Post on 19-Jan-2016

232 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Spline Interpolation A Primer on the Basics by Don Allen

Spline Interpolation

A Primer on the Basicsby

Don Allen

Page 2: Spline Interpolation A Primer on the Basics by Don Allen

What are Splines?

• Splines interpolate data.• Lower degree curves are used.• Thus fewer points must be used.

Consequently, we obtain a piecewise curve, valid only over a specific interval.

• Splines allow matching conditions – not unlike Hermite interpolation – but different

Data: x i, y i, i 0, 1, , n

Page 3: Spline Interpolation A Primer on the Basics by Don Allen

Linear SplineData: x i, y i, i 0, 1, , n

Page 4: Spline Interpolation A Primer on the Basics by Don Allen

The Linear Spline

Data: x i, y i, i 0, 1, , n

Page 5: Spline Interpolation A Primer on the Basics by Don Allen

Piecewise Polynomials

Page 6: Spline Interpolation A Primer on the Basics by Don Allen

Linear Splines

Page 7: Spline Interpolation A Primer on the Basics by Don Allen

Quadratic SplineData: x i, y i, i 0, 1, , n

Page 8: Spline Interpolation A Primer on the Basics by Don Allen

Cubic SplineTo fit cubics to groups of four points.

Rarely done

Data: x i, y i, i 0, 1, , n

Page 9: Spline Interpolation A Primer on the Basics by Don Allen

Cubic SplineTo fit cubics to successive pairs of points, with matching conditions.

Data: x i, y i, i 0, 1, , n

Page 10: Spline Interpolation A Primer on the Basics by Don Allen

How it looks

Data: x i, y i, i 0, 1, , n

Page 11: Spline Interpolation A Primer on the Basics by Don Allen

Splines vs. Polynomials

• Remember the function →•This function interpolated poorly at equally spaced points.

•Let’s compare with how well the natural cubic spline performs.

fx 1

1 5x 2

Page 12: Spline Interpolation A Primer on the Basics by Don Allen

Function and Interpolant

12 equally spaced pointsFunction in RedInterpolant in blue

Page 13: Spline Interpolation A Primer on the Basics by Don Allen

Function and Cubic Spline

12 equally spaced points;Function in RedSpline in blue

Page 14: Spline Interpolation A Primer on the Basics by Don Allen

Function, Interpolant, Cubic Spline

12 equally spaced points;Function in GreenSpline in RedInterpolant in Blue

Page 15: Spline Interpolation A Primer on the Basics by Don Allen

Cubic Spline – the equations

Page 16: Spline Interpolation A Primer on the Basics by Don Allen

Cubic Spines

• Two types: both involve endpoint conditions– Natural S’’(endpoints) = 0– Clamped S’(endpoints) = f’(endpoints)

• The error in interpolating a function with a clamped cubic spline depends on the fourth derivative.

Page 17: Spline Interpolation A Primer on the Basics by Don Allen

Cubic Spline – derivation

Page 18: Spline Interpolation A Primer on the Basics by Don Allen

Cubic Splines

• There are natural and clamped types• They are very accurate in practice.• They avoid most of the pitfalls of general

polynomial interpolation.• It is remarkably easy to program for the

coefficients. • The error depends on the second derivative.• Full details are in the text and lecture notes.

Page 19: Spline Interpolation A Primer on the Basics by Don Allen

Another Nasty Example

Page 20: Spline Interpolation A Primer on the Basics by Don Allen

Another Nasty Example

Page 21: Spline Interpolation A Primer on the Basics by Don Allen

Another Nasty Example

Page 22: Spline Interpolation A Primer on the Basics by Don Allen

Another Nasty Example