43
Interpolation - 2D mapping Tutorial 1: triangulation Measurements (Z k ) at irregular points (x k , y k ) Ex: CTD stations, mooring, etc ... The “known Data” X Y How to compute some values on the regular spaced grid points (+) ? The” unknown data” Z i known data estimated data linear combination

Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

  • Upload
    others

  • View
    60

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mappingTutorial 1: triangulation

Measurements (Zk) at irregular points (x

k , y

k)

Ex: CTD stations, mooring, etc ...The “known Data”

X

Y

How to computesome values on the

regular spacedgrid points (+) ?

The” unknown data”Z

i

knowndata

estimateddata

linearcombination

Page 2: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mappingTutorial 1: triangulation

Measurements (Zk) at irregular points (x

k , y

k)

Ex: CTD stations, mooring, etc ...The “known Data”

X

Y

How to computesome values on the

regular spacedgrid points (+) ?

The” unknown data”Z

i

knowndata

estimateddata

linearcombination

Page 3: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

1

3

2

Interpolation - 2D mappingTutorial 1: triangulation

Page 4: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

http://en.wikipedia.org/wiki/Barycentric_coordinate_system

Page 5: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation
Page 6: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension linear

interpolation

Data Points

Estimated Value

Page 7: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

RT is the error asociated to the method.

We try to estimate the maximum possible error.

Estimation of the error:

Page 8: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension linear

interpolation

Page 9: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension linear

interpolation

http://fr.mathworks.com/moler/

The derivative is notcontinuous:

Piecewise linearinterpolation is notdifferentiable at the

xdata points

Page 10: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Matlab tutorial:Make a Piecewise linear interpolation porgram using matlabCompare results with the interp1 matlab command

Page 11: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

http://fr.mathworks.com/moler/

Interpolation - 2D mapping1 dimension

Lagrange polynomial interpolation

Page 12: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

http://fr.mathworks.com/moler/

Interpolation - 2D mapping1 dimension

Lagrange polynomial interpolation

Page 13: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

http://fr.mathworks.com/moler/

Page 14: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

VANDERMONDE MATRIX

Interpolation - 2D mapping1 dimension

Lagrange polynomial interpolation

http://fr.mathworks.com/moler/

Page 15: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Lagrange polynomial interpolation

http://fr.mathworks.com/moler/

Page 16: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Lagrange polynomial interpolationExemple 2:

http://fr.mathworks.com/moler/

Page 17: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Lagrange polynomial interpolationExemple 2:

Polynomial interpolation isdifferentiable at the xdata

points

Polynomial interpolationmay generate overshoots,

spikes

http://fr.mathworks.com/moler/

Page 18: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping2 dimension bilinear

interpolation

Data Points

Estimated value

http://en.wikipedia.org/wiki/Bilinear_interpolation

Page 19: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping2 dimension bilinear

interpolation

http://en.wikipedia.org/wiki/Bilinear_interpolation

Page 20: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

http://fr.mathworks.com/moler/

Interpolation - 2D mapping1 dimension

Piecewise Cubic Hermite Interpolation

Hermite function :Functions that satisfy interpolation conditions derivatives

If we know P(xk),P'(x

k),P(x

k+1),P'(x

k+1) then piecewise cubic Hermite interpolation can reproduce

the data on the interval [xk x

k+1]

Problem: We usually do not know the values of derivatives

Page 21: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Piecewise cubic interpolation

Functions that satisfy interpolation conditions on derivatives: HERMITE interpolants

on the interval xk< x< x

k+1

s = x - xk

Conditions satisfiedby this function:

Knowing BOTH values of the functions and its FIRST derivatives at a discreteset of data points, then, we can reproduce the data on each interval x

k< x< x

k+1

Page 22: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Piecewise cubic interpolation

Knowing BOTH values of the functions and its FIRST derivatives at a discreteset of data points, then, we can reproduce the data on each interval x

k< x< x

k+1

PROBLEMS:What happens if we do not know the derivatives ....???

There are different ways of estimating these derivatives.We look for a way that reduces the overshoots and spikes.

- splines- shape preserving cubics

Page 23: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Shape preserving cubic interpolation

We wish to determine the slope dk so that the function values do not overshoot

Piecewise linear interpolation(straight line)

Curve line (shape preserving)

JUMP in secondderivative !

Page 24: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Shape preserving cubic interpolation

We wish to determine the slope dk so that the function values do not overshoot

Piecewise linear interpolation(straight line)

Curve line (shape preserving)

JUMP in secondderivative !

Page 25: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Shape preserving cubic interpolation

We wish to determine the slope dk so that the function values do not overshoot

Page 26: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation
Page 27: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation
Page 28: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

We still need to evaluate the slopes dk

Harmonic mean at interior points (it tends (compared to the arithmetic mean) to mitigate the impact of largeoutliers and aggravate the impact of small ones. Ex: speed of a car)

Page 29: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

One-sided formula at end points ....

Page 30: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Arithmetic and Harmonic mean:A car travels a distance h1 and speed v1, and distance h2 at speed v2

Arithmetic mean:vbarith=(v1+V2)/2

Harmonic mean:t1=d1/v1t2=d2/v2

vbarharm=(d1+d2)/(d1/v1+d2/v2)

Page 31: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Shape preserving cubic interpolation

Page 32: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Cubic Spline interpolation

We add a constraint on thecontinuity of the second derivative

Page 33: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Cubic Spline interpolationWe add a constraint on the continuity of the second derivative

Valid on the interval:x

k< x< x

k+1

Page 34: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Cubic Spline interpolationWe add a constraint on the continuity of the second derivative:

P''(xk

+)=P''(xk

-)

This approach can be applied to the interior “knots”, k=2,...n-1=> (n-2) equations

We must add boundary conditions on the “first” and “end” intervals

Here written for hk=cte

“not a knot “ choice for x2 and x

n-1

We write the equations on the interval:x

1< x < x

3

xn-2

<x<xn

Page 35: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation
Page 36: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Interpolation - 2D mapping1 dimension

Piecewise cubic interpolation

Functions that satisfy interpolation conditions on derivatives: HERMITE interpolants

on the interval xk< x< x

k+1

s = x - xk

Conditions satisfiedby this function:

Page 37: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Boundary Conditions for splines

● Natural Spline:

(N points, N-1 intervals)

Page 38: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Boundary Conditions for splines

● Not a Knot:

Page 39: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Boundary Conditions for splines

● Periodic boundary conditions:

x2

x3

x4

xN-3

xN-2

xN-1

xN

xN+1

x1

x0

GHOSTPOINT

GHOSTPOINT

L

Page 40: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

Boundary Conditions for splines

● Periodic boundary conditions:

x2

x3

x4

xN-3

xN-2

xN-1

xN

xN+1

x1

x0

GHOSTPOINT

GHOSTPOINT

L

Page 41: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation
Page 42: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation
Page 43: Interpolation - 2D mapping Tutorial 1: triangulationstockage.univ-brest.fr/~herbette/...interpolation... · Interpolation - 2D mapping 1 dimension Piecewise Cubic Hermite Interpolation

● These techniques can be adapted to 2D or 3D● If sparse data, and a smooth is what you are

looking for, then a spline surface is adapted● If very noisy data, or closely spaced data, then

a “smoothed spline”, may be better.● See Smith and Wessel (1990)