Curves and Interpolation: Dr. Scott Schaefer

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 61

1

Dr. Scott Schaefer


Curves and Interpolation
2/61
Smooth Curves
How do we create smooth curves?
3/61
Smooth Curves
How do we create smooth curves?

Parametric curves with polynomials
( ) ) ( ), ( ) ( t y t x t p =
4/61
Smooth Curves
Controlling the shape of the curve




3 2
3 2
) (
) (
ht gt ft e t y
dt ct bt a t x
+ + + =
+ + + =
5/61
Smooth Curves
Controlling the shape of the curve




3 2
1 ) (
) (
t t t t y
t t x
+ =
=
6/61
Smooth Curves
Controlling the shape of the curve




3 2
3 ) (
) (
t t t t y
t t x
+ =
=
7/61
Smooth Curves
Controlling the shape of the curve




3 2
1 ) (
) (
t t t t y
t t x
+ =
=
8/61
Smooth Curves
Controlling the shape of the curve




3 2
1 ) (
) (
t t t t y
t t x
+ + =
=
9/61
Smooth Curves
Controlling the shape of the curve




3 2
1 ) (
) (
t t t t y
t t x
+ =
=
10/61
Smooth Curves
Controlling the shape of the curve




3 2
3 1 ) (
) (
t t t t y
t t x
+ =
=
11/61
Smooth Curves
Controlling the shape of the curve




3 2
1 ) (
) (
t t t t y
t t x
+ =
=
12/61
Smooth Curves
Controlling the shape of the curve




3 2
1 ) (
) (
t t t t y
t t x
+ + =
=
13/61
Smooth Curves
Controlling the shape of the curve




3 2
1 ) (
) (
t t t t y
t t x
+ + =
=
Power-basis coefficients not intuitive
for controlling shape of curve!!!
14/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i

y
t
3
3
2
2 1 0
) ( t c t c t c c t y + + + =
15/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i

y
t
3
3
2
2 1 0
) ( t c t c t c c t y + + + =
( ) ) ( ... 1
2
1
0
2
t y
c
c
c
c
t t t
n
n
=
|
|
|
|
|
|
.
|

\
|

16/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i

y
t
3
3
2
2 1 0
) ( t c t c t c c t y + + + =
( ) ) ( ... 1
2
1
0
2
t y
c
c
c
c
t t t
n
n
=
|
|
|
|
|
|
.
|

\
|

basis
17/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i

y
t
3
3
2
2 1 0
) ( t c t c t c c t y + + + =
( ) ) ( ... 1
2
1
0
2
t y
c
c
c
c
t t t
n
n
=
|
|
|
|
|
|
.
|

\
|

coefficients
18/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i

y
t
3
3
2
2 1 0
) ( t c t c t c c t y + + + =
|
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
|
.
|

\
|
|
|
|
|
|
.
|

\
|
n n
n
n n n
n
n
y
y
y
y
c
c
c
c
t t t
t t t
t t t


2
1
0
2
1
0
2
1
2
1 1
0
2
0 0
... 1
... 1
... 1
19/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i

y
t
3
3
2
2 1 0
) ( t c t c t c c t y + + + =
|
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
|
.
|

\
|
|
|
|
|
|
.
|

\
|
n n
n
n n n
n
n
y
y
y
y
c
c
c
c
t t t
t t t
t t t


2
1
0
2
1
0
2
1
2
1 1
0
2
0 0
... 1
... 1
... 1
Vandermonde matrix
20/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i

y
t
3
3
2
2 1 0
) ( t c t c t c c t y + + + =
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
.
|

\
|
|
|
|
|
|
.
|

\
|
1
3
1
3
27 9 3 1
8 4 2 1
1 1 1 1
0 0 0 1
3
2
1
0
c
c
c
c
21/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i

y
t
3
3
2
2 1 0
) ( t c t c t c c t y + + + =
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
.
|

\
|

3
1
3
20
3
2
1
0
6
3
c
c
c
c
22/61
Interpolation
Find a polynomial y(t) such that y(t
i
)=y
i


y
t
Intuitive control of curve using
control points!!!
23/61
Interpolation
Perform interpolation for each component
separately
Combine result to obtain parametric curve
y
x
( ) ) ( ), ( ) ( t y t x t p =
24/61
Interpolation
Perform interpolation for each component
separately
Combine result to obtain parametric curve
y
x
( ) ) ( ), ( ) ( t y t x t p =
25/61
Interpolation
Perform interpolation for each component
separately
Combine result to obtain parametric curve
y
x
( ) ) ( ), ( ) ( t y t x t p =
26/61
Generalized Vandermonde Matrices
Assume different basis functions f
i
(t)
|
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
|
.
|

\
|
|
|
|
|
|
.
|

\
|
n n
n n n n n
n
n
y
y
y
y
c
c
c
c
t f t f t f t f
t f t f t f t f
t f t f t f t f


2
1
0
2
1
0
2 1 0
1 1 2 1 1 1 0
0 0 2 0 1 0 0
) ( ... ) ( ) ( ) (
) ( ... ) ( ) ( ) (
) ( ... ) ( ) ( ) (

=
i
i i
t f c t y ) ( ) (
27/61
LaGrange Polynomials
Explicit form for interpolating polynomial!
[
=

=
i j
j i
j
i
t t
t t
t L
) (
) (
) (
28/61
LaGrange Polynomials
Explicit form for interpolating polynomial!
[
=

=
i j
j i
j
i
t t
t t
t L
) (
) (
) (
1.5

2

2.5

3

3.5

4

-0.2

0.2

0.4

0.6

0.8

1

29/61
1.5

2

2.5

3

3.5

4

-0.2

0.2

0.4

0.6

0.8

1

LaGrange Polynomials
Explicit form for interpolating polynomial!
[
=

=
i j
j i
j
i
t t
t t
t L
) (
) (
) (
30/61
1.5

2

2.5

3

3.5

4

-0.2

0.2

0.4

0.6

0.8

1

LaGrange Polynomials
Explicit form for interpolating polynomial!
[
=

=
i j
j i
j
i
t t
t t
t L
) (
) (
) (
31/61
1.5

2

2.5

3

3.5

4

-0.2

0.2

0.4

0.6

0.8

1

LaGrange Polynomials
Explicit form for interpolating polynomial!
[
=

=
i j
j i
j
i
t t
t t
t L
) (
) (
) (
32/61
LaGrange Polynomials
Explicit form for interpolating polynomial!
[
=

=
i j
j i
j
i
t t
t t
t L
) (
) (
) (

=
=
n
i
i i
t L y t y
0
) ( ) (
33/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
34/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
) (t f
1 0
) 1 ( ) ( y t y t t f + =
35/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
) (t f
1 0
) 1 ( ) ( y t y t t f + =
2
y
) (t g
2 1
) 1 ( ) 2 ( ) ( y t y t t g + =
36/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
1 0
) 1 ( ) ( y t y t t f + =
2
y
) (t h
2 1
) 1 ( ) 2 ( ) ( y t y t t g + =
2
) ( ) ( ) 2 (
) (
t g t t f t
t h
+
=
37/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
1 0
) 1 ( ) ( y t y t t f + =
2
y
) (t h
2 1
) 1 ( ) 2 ( ) ( y t y t t g + =
2
) ( ) ( ) 2 (
) (
t g t t f t
t h
+
=
2
) 1 ( 1 ) 1 ( ) 1 2 (
) 1 (
g f
h
+
=
38/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
1 0
) 1 ( ) ( y t y t t f + =
2
y
) (t h
2 1
) 1 ( ) 2 ( ) ( y t y t t g + =
2
) ( ) ( ) 2 (
) (
t g t t f t
t h
+
=
1
1 1
2
) 1 ( y
y y
h =
+
=
39/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
1 0
) 1 ( ) ( y t y t t f + =
2
y
) (t h
2 1
) 1 ( ) 2 ( ) ( y t y t t g + =
2
) ( ) ( ) 2 (
) (
t g t t f t
t h
+
=
2
) 0 ( 0 ) 0 ( ) 0 2 (
) 0 (
g f
h
+
=
40/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
1 0
) 1 ( ) ( y t y t t f + =
2
y
) (t h
2 1
) 1 ( ) 2 ( ) ( y t y t t g + =
2
) ( ) ( ) 2 (
) (
t g t t f t
t h
+
=
0
0
2
2
) 0 ( y
y
h = =
41/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
1 0
) 1 ( ) ( y t y t t f + =
2
y
) (t h
2 1
) 1 ( ) 2 ( ) ( y t y t t g + =
2
) ( ) ( ) 2 (
) (
t g t t f t
t h
+
=
2
) 2 ( 2 ) 2 ( ) 2 2 (
) 2 (
g f
h
+
=
42/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
1 0
) 1 ( ) ( y t y t t f + =
2
y
) (t h
2 1
) 1 ( ) 2 ( ) ( y t y t t g + =
2
) ( ) ( ) 2 (
) (
t g t t f t
t h
+
=
2
2
2
2
) 2 ( y
y
h = =
43/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
2
y
) (t h
3
y
44/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
2
y
) (t k
3
y
45/61
Nevilles Algorithm
Identical to matrix method but uses a
geometric construction
y
t
0
1 2
3
0
y
1
y
2
y
) (t m
3
y
3
) ( ) ( ) 3 (
) (
t k t t h t
t m
+
=
46/61
Nevilles Algorithm

0
y
1
y
2
y
3
y
0 1
1
t t
t t

0 1
0
t t
t t

1 2
2
t t
t t

2 3
3
t t
t t

1 2
1
t t
t t

2 3
2
t t
t t

) (
01
t y
) (
12
t y
) (
23
t y
47/61
Nevilles Algorithm

0
y
1
y
2
y
3
y
0 1
1
t t
t t

0 1
0
t t
t t

1 2
2
t t
t t

2 3
3
t t
t t

1 2
1
t t
t t

2 3
2
t t
t t

) (
01
t y
) (
12
t y
) (
23
t y
) (
012
t y ) (
123
t y
0 2
0
t t
t t

0 2
2
t t
t t

1 3
3
t t
t t

1 3
1
t t
t t

48/61
Nevilles Algorithm

0
y
1
y
2
y
3
y
0 1
1
t t
t t

0 1
0
t t
t t

1 2
2
t t
t t

2 3
3
t t
t t

1 2
1
t t
t t

2 3
2
t t
t t

) (
01
t y
) (
12
t y
) (
23
t y
) (
012
t y ) (
123
t y
) (
0123
t y
0 2
0
t t
t t

0 2
2
t t
t t

1 3
3
t t
t t

1 3
1
t t
t t

0 3
3
t t
t t

0 3
0
t t
t t

49/61
Nevilles Algorithm
Claim: The polynomial produced by Nevilles
algorithm is unique
50/61
Nevilles Algorithm
Claim: The polynomial produced by Nevilles
algorithm is unique
Proof: Assume that there are two degree n
polynomials such that
a(t
i
)=b(t
i
)=y
i
for i=0n.

) ( ) ( t b t a =
51/61
Nevilles Algorithm
Claim: The polynomial produced by Nevilles
algorithm is unique
Proof: Assume that there are two degree n
polynomials such that
a(t
i
)=b(t
i
)=y
i
for i=0n.
c(t)=a(t)-b(t) is also a polynomial of degree n

) ( ) ( t b t a =
52/61
Nevilles Algorithm
Claim: The polynomial produced by Nevilles
algorithm is unique
Proof: Assume that there are two degree n
polynomials such that
a(t
i
)=b(t
i
)=y
i
for i=0n.
c(t)=a(t)-b(t) is also a polynomial of degree n
c(t) has n+1 roots at each of the t
i


) ( ) ( t b t a =
53/61
Nevilles Algorithm
Claim: The polynomial produced by Nevilles
algorithm is unique
Proof: Assume that there are two degree n
polynomials such that
a(t
i
)=b(t
i
)=y
i
for i=0n.
c(t)=a(t)-b(t) is also a polynomial of degree n
c(t) has n+1 roots at each of the t
i

Polynomials of degree n can have at most n
roots!
) ( ) ( t b t a =
54/61
) (
i
m
i
y
Hermite Interpolation
Find a polynomial y(t) that interpolates y
i
,
y
i
(1)
, y
i
(2)
, ,
Always a unique y(t) of degree

+
i
i
m n 1
55/61
) (
i
m
i
y
Hermite Interpolation
Find a polynomial y(t) that interpolates y
i
,
y
i
(1)
, y
i
(2)
, ,
Always a unique y(t) of degree

+
i
i
m n 1
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
.
|

\
|
|
|
|
|
|
.
|

\
|
1
) 1 (
1
) 1 (
0
0
3
2
1
0
1 3 1 2 1 1 1 0
1
) 1 (
3 1
) 1 (
2 1
) 1 (
1 1
) 1 (
0
0
) 1 (
3 0
) 1 (
2 0
) 1 (
1 0
) 1 (
0
0 3 0 2 0 1 0 0
) ( ) ( ) ( ) (
) ( ) ( ) ( ) (
) ( ) ( ) ( ) (
) ( ) ( ) ( ) (
y
y
y
y
c
c
c
c
t f t f t f t f
t f t f t f t f
t f t f t f t f
t f t f t f t f
56/61
) (
i
m
i
y
Hermite Interpolation
Find a polynomial y(t) that interpolates y
i
,
y
i
(1)
, y
i
(2)
, ,
Always a unique y(t) of degree

+
i
i
m n 1
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
.
|

\
|
|
|
|
|
|
.
|

\
|
1
) 1 (
1
) 1 (
0
0
3
2
1
0
3
1
2
1 1
2
1 1
2
0 0
3
0
2
0 0
1
3 2 1 0
3 2 1 0
1
y
y
y
y
c
c
c
c
t t t
t t
t t
t t t
57/61
) (
i
m
i
y
Hermite Interpolation
Find a polynomial y(t) that interpolates y
i
,
y
i
(1)
, y
i
(2)
, ,
Always a unique y(t) of degree

+
i
i
m n 1
|
|
|
|
|
.
|

\
|
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
.
|

\
|

1
) 1 (
1
) 1 (
0
0
1
3
1
2
1 1
2
1 1
2
0 0
3
0
2
0 0
3
2
1
0
1
3 2 1 0
3 2 1 0
1
y
y
y
y
t t t
t t
t t
t t t
c
c
c
c
58/61
) (
i
m
i
y
Hermite Interpolation
Find a polynomial y(t) that interpolates y
i
,
y
i
(1)
, y
i
(2)
, ,
Always a unique y(t) of degree

+
i
i
m n 1
( ) ( )
|
|
|
|
|
.
|

\
|
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
.
|

\
|
=

1
) 1 (
1
) 1 (
0
0
1
3
1
2
1 1
2
1 1
2
0 0
3
0
2
0 0
3 2
3
2
1
0
3 2
1
3 2 1 0
3 2 1 0
1
1 1 ) (
y
y
y
y
t t t
t t
t t
t t t
t t t
c
c
c
c
t t t t y
59/61
) (
i
m
i
y
Hermite Interpolation
Find a polynomial y(t) that interpolates y
i
,
y
i
(1)
, y
i
(2)
, ,
Always a unique y(t) of degree

+
i
i
m n 1
|
|
|
|
|
.
|

\
|

+
=
|
|
|
|
|
.
|

\
|
2
2
2
2
3
3
3
2
3
1
3
0
) 2 3 (
) 1 (
) 1 (
) 2 1 ( ) 1 (
t t
t t
t t
t t
H
H
H
H
60/61
) (
i
m
i
y
Hermite Interpolation
Find a polynomial y(t) that interpolates y
i
,
y
i
(1)
, y
i
(2)
, ,
Always a unique y(t) of degree

+
i
i
m n 1
61/61
) (
i
m
i
y
Hermite Interpolation
Find a polynomial y(t) that interpolates y
i
,
y
i
(1)
, y
i
(2)
, ,
Always a unique y(t) of degree

+
i
i
m n 1

You might also like