Cubic Spline Interpolation

VARUNKUMAR391 1,262 views 9 slides Sep 13, 2021
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

Cubic Spline Interpolation


Slide Content

Cubic Spline Interpolation
Dr. Varun Kumar
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 1 / 9

Outlines
1
Introduction to Splines
2
Cubic splines
3
Example
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 2 / 9

Introduction to Splines
Important points
)Quality of interpolation increases with increasing degreenof the
polynomial used.
)Above statement is not absolutely true for very largen.
)For various function, the corresponding interpolation polynomials may
tend to oscillate more between the nodes causes.
Figure: f(x) =
1
1+x
2and interpolation polynomialP10(x)
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 3 / 9

Continued{
)Such oscillations are avoided by the method of splines.
)Givenf(x) onJ, we partitionJuniformly
a=x0<x1:::::xn=b (1)
)We require the functiong(x), which will interpolatef(x) onJ.
)Thusg(x0) =f(x0); ::::;g(xn) =f(xn)
)Obtainedg(x) is called spline.
)Iff(x) is given ona5x5band a partition (1) has been chosen, we
obtain a cubic splineg(x) that approximatef(x) by acquiring that
g(x0) =f(x0) =f0;g(x1) =f(x1) =f1;g(xn) =f(xn) =fn;(2)
g
0
(x0) =k0g
0
(xn) =kn (3)
)Note:k0andknare given number
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 4 / 9

Cubic splines
Theorem 1: f(x) be dened on the intervala5x5b, let a partition
(1) be given, and letk0andknbe any two given numbers. Then there
exists one and only one cubic splineg(x) corresponding to (1) and
satisfying (2) and (3)
Important Results:
(1)cj1kj1+ 2(cj1+cj)kj+cjkj+1= 3
h
c
2
j1
rfj+c
2
j
rfj+1
i
(2)
kj1+ 4kj+kj+1=
3
h
(fj+1fj1)
(3)
pj(x) =aj0+aj1(xxj) +aj2(xxj)
2
+aj3(xxj)
3
8xj5x5xj+1
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 5 / 9

Continued{
(4)aj0=pj(xj) =fj
(5)aj1=p
0
j
(xj) =kj
(6)aj2=
1
2
p
00
j
(xj) =
3
h
2(fj+1fj)
1
h
(kj+1+ 2kj)
(7)aj3=
1
6
p
000
j
(xj) =
2
h
3(fjfj+1) +
1
h
2(kj+1+kj)
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 6 / 9

Example:
Q f(x) =x
4
on the interval15x51 by cubic spline
g(x) corresponding to the partitionx0=1,x1= 0,x2= 1 and
satisfying the clamped conditionsg
0
(1) =f
0
(1),g
0
(1) =f
0
(1)
Ans
f0=f(1) = 1,f1=f(0) = 0,f2=f(1) = 1. The given interval is
partitioned inton= 2 parts andh= 1. Hence splinegconsists of
n= 2 polynomial.
p0(x) =a00+a01(x+ 1) +a02(x+ 1)
2
+a03(x+ 1)
3
15x50
p1(x) =a10+a11x+a12x
2
+a13x
3
05x51
Step 1: p0(x) andp1(x). Sincen= 2, letj= 1 then
k0+ 4k1+k2=
3
1
(f2f0)
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 7 / 9

Continued{
Nowp
0
0
(x0) =k0andp
0
1
(x2) =k2. Butg=p0atx0=1 andg=p1at
x2= 1. Hence, as given (g
0
=f
0
at1)
f
0
(1) =4 =g
0
(1) =p
0
0(1) =k0;f
0
(1) = 4 =g
0
(1) =p
0
1(1) =k2
Substitution ofk0=4 andk2= 4)k1= 0
Step 2:We can now obtain the coecient ofp0.
a00=f0= 1,a01=k0=4
a02=
3
1
2(f1f0)
1
1
(k1+ 2k0) = 5
a03=
2
1
3(f0f1) +
1
1
2(k1+k0) =2
Similarlya10=f1= 0,a11=k1= 0,a12=1,a13= 2
This gives the polynomial
p0(x) = 14(x+ 1) + 5(x+ 1)
2
2(x+ 1)
3
=x
2
2x
3
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 8 / 9

Continued{
p1(x) =x
2
+ 2x
3
or
g(x) =x
2
2x
3
if15x50
=x
2
+ 2x
3
if05x51
Figure: f(x) =x
4
and cubic splineg(x)
Dr. Varun Kumar(IIIT Surat) Unit 2 / Lecture-5 9 / 9