Spline Interpolation Method - Numerical Methods - Lecture Slides, Slides of Mathematical Methods for Numerical Analysis and Optimization

The main points are: Spline Interpolation Method, Choice of Interpolants, Differentiate and Integrate, Equidistantly Spaced Points, Exact Function, Polynomial Interpolation, Linear Interpolation, Linear Splines, Simply Slopes

Typology: Slides

2012/2013

Uploaded on 04/17/2013

pankarithi
pankarithi ๐Ÿ‡ฎ๐Ÿ‡ณ

4.6

(5)

59 documents

1 / 27

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Spline Interpolation Method
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Partial preview of the text

Download Spline Interpolation Method - Numerical Methods - Lecture Slides and more Slides Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Spline Interpolation Method

What is Interpolation?

Given (x

,y

), (x

,y

), โ€ฆโ€ฆ (x

n

,y

n

), find the

value of โ€˜yโ€™ at a value of โ€˜xโ€™ that is not given.

Why Splines?

2 1 25

1 ( )

x

f x

=

Table : Six equidistantly spaced points in [-1, 1]

Figure : 5

th order polynomial vs. exact function

x (^) 2 1 25

1

x

y

=

  • 1.0 0.
  • 0.6 0.
  • 0.2 0.

0.2 0.

0.6 0.

1.0 0.

Why Splines?

Figure : Higher order polynomial interpolation is a bad idea

-0.

-0.

0

-1 -0.5 0 0.5 1

x

y

19th Order Polynomial f (x) 5th Order Polynomial

Linear Interpolation (contd)

( ),

( ) ( ) ( ) ( ) 0 1 0

1 0 0 x x x x

f x f x f x f x โˆ’ โˆ’

โˆ’ = + x (^) 0 โ‰ค x โ‰ค x 1

( ),

( ) ( ) ( ) 1 2 1

2 1 1 x x x x

f x f x f x โˆ’ โˆ’

โˆ’ = + x 1 (^) โ‰ค x โ‰ค x 2

.

.

.

( ),

( ) ( ) ( ) 1 1

1 1 โˆ’ โˆ’

โˆ’ โˆ’ โˆ’ โˆ’

โˆ’ = + n n n

n n n x x x x

f x f x f x x (^) n โˆ’ 1 โ‰ค x โ‰ค xn

Note the terms of

1

( ) ( 1 )

โˆ’

โˆ’ โˆ’

โˆ’

i i

i i x x

f x f x

in the above function are simply slopes between xi โˆ’ 1 and x i.

Example

The upward velocity of a rocket is given as a function

of time in Table 1. Find the velocity at t=16 seconds

using linear splines.

Table Velocity as a

function of time

Figure. Velocity vs. time data
for the rocket example
(s) (m/s)

t v ( t )

Quadratic Interpolation

Given ( x (^) 0 , y 0 ) (, x 1 , y 1 ),......, ( xn โˆ’ 1 , yn โˆ’ 1 ) (, xn , yn ), fit quadratic splines through the data. The splines

are given by

( ) 1 1 ,

2 f x = a 1 x + bx + c x (^) 0 โ‰ค x โ‰ค x 1

2 2 ,

2 = a (^) 2 x + b x + c x 1 (^) โ‰ค x โ‰ค x 2

.

.

.

,

2 = a (^) n x + bnx + c n x (^) n โˆ’ 1 โ‰ค x โ‰ค xn

Find a i , bi , ci , i =1, 2, โ€ฆ, n

Quadratic Interpolation (contd)

Each quadratic spline goes through two consecutive data points

1 0 1 (^0 )

2 a 1 (^) x 0 + bx + c = f x

1 1 1 (^1 )

2 a 1 (^) x 1 + bx + c = f x.

.

.

1 (^1 )

2 ai xi โˆ’ 1 + bixi โˆ’ + ci = f xi โˆ’

( )

2 a (^) i xi + bixi + ci = f x i.

.

.

1 (^1 )

2 an xn โˆ’ 1 + bnxn โˆ’ + cn = f xn โˆ’

( )

2 a (^) n xn + bnxn + cn = f x n

This condition gives 2n equations

Quadratic Splines (contd)

Similarly at the other interior points,

2 a 2 x 2 + b 2 โˆ’ 2 a 3 x 2 โˆ’ b 3 = 0

.

.

.

2 ai xi + bi โˆ’ 2 ai + 1 xi โˆ’ bi + 1 = 0

.

.

.

2 an โˆ’ 1 xn โˆ’ 1 + bn โˆ’ 1 โˆ’ 2 anxn โˆ’ 1 โˆ’ bn = 0

We have (n-1) such equations. The total number of equations is ( 2 n ) + ( n โˆ’ 1 )=( 3 n โˆ’ 1 ).

We can assume that the first spline is linear, that is a 1 = 0

Quadratic Splines (contd)

This gives us โ€˜3nโ€™ equations and โ€˜3nโ€™ unknowns. Once we find the โ€˜3nโ€™ constants,
we can find the function at any value of โ€˜xโ€™ using the splines,

( ) 1 1 ,

2 f x = a 1 x + b x + c x 0 (^) โ‰ค x โ‰ค x 1

2 2 ,

2 = a (^) 2 x + b x + c x 1 (^) โ‰ค x โ‰ค x 2

.

.

.

,

2 = a (^) n x + bnx + c n x (^) n โˆ’ 1 โ‰ค x โ‰ค xn

Solution

1 1

2

1

v t = a t + b t + c 0 โ‰ค t โ‰ค 10

, 2 2

2

2

= a t + b t + c 10 โ‰ค t โ‰ค 15

, 3 3

2

3

= a t + b t + c 15 โ‰ค t โ‰ค 20

, 4 4

2

4

= a t + b t + c 20 โ‰ค t โ‰ค 22. 5

, 5 5

2

5

= a t + b t + c 22. 5 โ‰ค t โ‰ค 30

Let us set up the equations

Each Spline Goes Through Two

Consecutive Data Points

( ) , 1 1

2

1

v t = a t + b t + c 0 โ‰ค t โ‰ค 10

( 0 ) ( 0 ) 0 1 1

2

1

a + b + c =

( 10 ) ( 10 ) 227. 04 1 1

2

1

a + b + c =

Derivatives are Continuous at

Interior Data Points

v t = a t + b t + c^0 โ‰ค^ t โ‰ค^10

2 2

2

2

= a t + b t + c 10 โ‰ค t โ‰ค 15

t t

a t b t c

dt

d

a t b t c

dt

d

t t

a t b a t b

2 a 10 + b = 2 a 10 + b

a + b โˆ’ a โˆ’ b =

Derivatives are continuous at

Interior Data Points

2 ( 10 ) 2 ( 10 ) 0 1 1 2 2

a + b โˆ’ a โˆ’ b =

2 ( 15 ) 2 ( 15 ) 0 2 2 3 3

a + b โˆ’ a โˆ’ b =

2 ( 20 ) 2 ( 20 ) 0 3 3 4 4

a + b โˆ’ a โˆ’ b =

2 ( 22. 5 ) 2 ( 22. 5 ) 0 4 4 5 5

a + b โˆ’ a โˆ’ b =

At t=

At t=

At t=

At t=22.