Académique Documents
Professionnel Documents
Culture Documents
Chapitre 4
Interpolation
polynomiale :
Collocation
Ift2421 1 Chapitre 4
Introduction
Interpolation
Extrapolation
Ift2421 2 Chapitre 4
Linéarisation par morceaux
Méthode en général
imprécise.
Ift2421 3 Chapitre 4
Méthode de collocation
Trouver un polynôme
qui passe par tous les points donnés.
Exemple : Remarque :
Ift2421 4 Chapitre 4
Recherche de Pn(x) : première approche
Pn(x) = a0 + a1 x + a2 x2 + ... + an xn
Remarque :
Ift2421 5 Chapitre 4
Unicité du polynôme de collocation
théorème:
Preuve:
Ift2421 6 Chapitre 4
Existence du polynôme de collocation
1.Cas linéaire ( n = 1 )
Cherchons P1(x) = a0 + a1 x
conditions de collocation:
P1(x0) = a0 + a1 x0 = f0
P1(x1) = a0 + a1 x1 = f1
( x − x1 ) ( x − x0 )
P1 (x ) = f0 + f
( x0 − x1 ) ( x1 − x0 ) 1
1 x 0 a 0 f 0 ⇒ A régulière
1 x ⋅ a = f ⇒ Solution a0, a1 unique
1 1 1
⇒ P1(x) unique
Ift2421 7 Chapitre 4
Exemple:
xi : 1.0 4.0
fi : 2.0 0.5
( x − 4) ( x − 1)
P1 ( x ) = 2.0 + 0.5
(1 − 4) (4 − 1)
2 8 1 1
P1 ( x ) = − x + + x −
3 3 6 6
1 5
P1 ( x ) = − x +
2 2
3.5
2.5
x1
2
1.5
1
x2
0.5
-1 1 2 3 4 5 6
-0.5
Ift2421 8 Chapitre 4
Existence du polynôme de collocation
2.Cas parabolique { n = 2 }
3 conditions
P2(x0) = a0 + a1 x0 + a2 x02 = f0
P2(x1) = a0 + a1 x1 + a2 x12 = f1
P2(x2) = a0 + a1 x2 + a2 x22 = f2
1 x0 x02 1 x0 x 02
det( A) = det 1 x1 x12 = det 0 x1 − x 0 x12 − x02
1 x2 x22 0 x2 − x 0 x22 − x02
det(A) ≠ 0 si xi ≠ xj
Ift2421 9 Chapitre 4
Solution sous la forme
( x − x1 )( x − x 2 )
P2 ( x ) = f
( x0 − x1 )( x 0 − x2 ) 0
( x − x 0 )( x − x2 )
+ f
( x1 − x 0 )( x1 − x2 ) 1
( x − x0 )( x − x1 )
+ f
( x 2 − x0 )( x2 − x1 ) 2
5
Exercice :
Interpoler F(1.7) dans la table P2(x)
4 P1(x)
x F(x)
0 1 3
1 1
2 2 2
1. Interpolation linéaire 1
P1(x) = x
P1(1.7) = 1.7 -1 1 2 3 4 5
2. Interpolation quadratique
P2(x) = ½ (x2 - x +2)
P2(1.7) = 1.595
Ift2421 10 Chapitre 4
Formulation générale de la méthode de Lagrange
x f(x)
x0 f0
x1 f1
... ...
xn fn
Définissons le polynôme
n
π i ( x) = ∏ ( x − x j ) pour i = 0,1,..., n
j =0
j ≠i
n
πi ( x)
Pn ( x ) = ∑ fi
i = 0 π i ( xi )
Ift2421 11 Chapitre 4
Exercice (suite):
Nous ajoutons un point
5
P3(x)
x F(x) P2(x)
4 P1(x)
0 1
1 1 3
2 2
3 5 2
3.Interpolation cubique 1
1
P3 ( x ) = ( x 3 − x + 6)
6 -1 1 2 3 4 5
P3(1.7) = 1.5355
Inconvénients de méthode
de Lagrange
Ift2421 12 Chapitre 4
Formule d'erreur du polynôme de collocation
Théorème:
Fonction d'erreur E:
E(x) = f(x) - Pn(x)
f ( n+1) (ξ ) n
E ( x) = ∏ ( x − xi )
(n + 1)! i = 0
Preuve:
n
W (t ) = f (t ) − Pn (t ) − g ( x )∏ (t − xi )
i =0
Cette fonction possède n+2 zéros { x, x0, x1 ... , xn }
dans I = [x0, xn];
f ( n +1) (ξ )
donc il existe ξ dans I = [x0, xn] tel que g( x) =
(n + 1)!
Ift2421 13 Chapitre 4
Calcul pratique de l'erreur
f ( n+1) (ξ ) n
E ( x) = ∏ ( x − xi )
(n + 1)! i = 0
Remarques :
Ift2421 14 Chapitre 4
Exemple: y = sinus(x)
P2(x)
Avec la table 1
X Y 0.8
0.9 0.78333
0.2
1.3 0.96356
1.7 0.99166 -0.5 0.5 1 1.5 2 2.5 3
-0.2
-0.4
Ift2421 15 Chapitre 4
Cas où les abscisses sont équidistantes
xi+1 - xi = h
Définition :
Différences descendantes
∆0fi = fi
∆1fi = fi+1 - fi
∆2fi = ∆1fi+1 - ∆1fi
........
∆n+1fi = ∆(∆nfi) = ∆nfi+1 - ∆nfi
Remarque :
L’ordre le plus élevé d’un tableau de n+1 valeurs est n.
Ift2421 16 Chapitre 4
Formule de Newton Gregory descendante
(cas où les abscisses sont équidistantes)
xi = x0 + i h
Or nous pouvons définir s par : x = x0 + s h
x - xi = ( s - i ) h
donc
n ∆k f 0 k −1
Pn ( x ) = f 0 + ∑ ∏ ( s − j )
k =0 k ! j =0
Ift2421 17 Chapitre 4
∆1 f 0 ∆2 f 0
x f(x)=∆0f ∆f ∆2f P2 ( x ) = f 0 + s+ s( s − 1)
0.1 0.09983
1! 2!
0.37960
0.5 0.47943 -0.07570 P2 ( x ) = 0.09983 + 0.37960 s
0.30390
− 0.07570
0.9 0.78333
0.18023
-0.12367
+ s( s − 1)
2!
1.3 0.96356 -0.15213
avec s = (x - 0.1) / (0.4)
0.02810
1.7 0.99166
Pour x = 0.8, nous avons
Calculer Sin(0.8) s = 7/4
avec x0 = 0.1 et un polynôme
de degré 2. Donc P2(0.8) = 0.71445
Notation :
s s ( s − 1)( s − 2) Κ ( s − k + 1)
=
k k!
s s 2 s 3 s n
Pn ( x ) = y0 + ∆y0 + ∆ y0 + ∆ y0 +Κ + ∆ y0
1 2 3 n
Ift2421 18 Chapitre 4
Remarques :
donc
s n +1
Pn+1 ( x ) = Pn ( x ) + ∆ f0
n + 1
Ift2421 19 Chapitre 4
Exemple : Sin(x) (suite)
− 0.04797
P3 ( x ) = P2 ( x ) + s( s − 1)( s − 2)
3!
1
0.8 Sin(x)
0.6
0.4 P3(x)
0.2
-0.2
-0.4
Ift2421 20 Chapitre 4
Erreur dans le cas de la formule de Newton Gregory
n s k s n+1
f ( x ) = Pn ( x ) + E ( x ) = ∑ ∆ f 0 + h f
( n +1)
(ξ )
k =0 k n + 1
s n+1 ( n +1) s n +1
E ( x) = h f (ξ ) ≈ ∆ f0
n + 1 n + 1
Remarques :
Ift2421 21 Chapitre 4
Exemple :
s 3 s ( s − 1)( s − 2)
E2 ( x) = ∆ f 0 = ( −0.04797)
3 6
E2(0.8) = 0.002623
Remarque :
Sin(0.8) - P2(0.8) = 0.00290422
Ift2421 22 Chapitre 4
2. Nous connaissons la fonction f(x) = Sin(x)
L’erreur est donnée par :
s
E 2 ( x ) = h 3 f 3 (ξ ) avec 0.1 ≤ ξ ≤ 0.9
3
f3(x) = - Cos(x)
s 3
E 2 (0.8) = − h Cos( ξ )
3
s 1 1 7 3 1 7
= s ( s − 1)( s − 2) = − = −
3 6 6 4 4 4 128
7 s 3 7
0.4 ∗0.62161 ≤ − h Cos( ξ ) ≤
3
0.4 3 ∗0.995004
128 3 128
Ift2421 23 Chapitre 4
Avantages de la formules de Newton Gregory
Inconvénients
Ift2421 24 Chapitre 4
Différences divisées
Définitions :
∆ [x , x , x ] =
2
[ ] [
∆ x j , x k − ∆ xi , x j ]
i j k
x k − xi
Ift2421 25 Chapitre 4
Formule de Newton pour les différences divisées
Pn ( x ) = f 0 + ∆[ x0 , x1 ]( x − x 0 ) + Κ
+ ∆n [ x0 , x1 ,Κ , xn ]( x − x0 )Κ ( x − x n−1 )
Ift2421 26 Chapitre 4
Exemple :
Calculons le Polynôme de degré 3 passant par :
x0=0 y0=1
0
x1=1 y1=1 1/2
1 -1/12
x2=2 y2=2 1/6
3/2
x3=4 y3=5
P3 ( x) = a0 + a1 ( x − x0 ) + a2 ( x − x0 ) ( x − x1 ) + a3 ( x − x0 ) ( x − x1 )( x − x2 )
1 1
P3 ( x ) = 1 + 0 + ( x − 0) ( x − 1) − ( x − 0) ( x − 1)( x − 2)
2 12
1
P3 ( x ) = ( − x 3 + 9 x 2 − 8 x + 12)
12
6
5
X3
3 P3(x)
2
X2
1
X0
X1
1 2 3 4 5
Ift2421 27 Chapitre 4
Calculons le Polynôme de degré 4 passant par les 4 points
précédents et ( x4 = 3, y4 = 5 ) :
P4 ( x ) = a 0 + a1 ( x − x0 ) + a 2 ( x − x0 ) ( x − x1 ) + a 3 ( x − x0 ) ( x − x1 )( x − x2 )
+ a 4 ( x − x0 ) ( x − x1 )( x − x2 )( x − x3 )
P4 ( x) = P3 ( x ) + a4 ( x − x0 ) ( x − x1 )( x − x2 )( x − x3 )
donc
1
P4 ( x ) = P3 ( x ) − x ( x − 1)( x − 2)( x − 4)
4
1 5 11 4
P4 ( x ) = − x 4 + x 3 − x 2 + x + 1
4 3 4 3
6
X4
5 X3
3 P3(x)
2
X2
1
X0
X1 P44(x)
1 2 3 4 5
Ift2421 28 Chapitre 4
Instabilité des polynômes d’interpolation d’ordre élevé
1.5
0.5
-1 -0.5 0.5 1
-0.5
Ift2421 29 Chapitre 4
1.5
1 P2(x)
0.5
-1 -0.5 0.5 1
-0.5
1.5
P4(x)
0.5
-1 -0.5 0.5 1
-0.5
-1
Ift2421 30 Chapitre 4
1.5
P6(x)
0.5
-1 -0.5 0.5 1
-0.5
-1
-1 -0.5 0.5 1
-1
-2
-3
-4
P8(x)
-5
-6
Ift2421 31 Chapitre 4
Conclusion sur les polynôme de collocation
1
Exemple :
-0.5
-1
Ift2421 32 Chapitre 4
Interpolation par les splines cubiques
Définition :
Spline
Généralisation mathématique
(Schoenberg, 1946)
Exemple:
1
0.8
0.6
0.4
0.2
1 2 3 4
Ift2421 33 Chapitre 4
Spline cubique
Continuité de f, f’ et f’’.
Exemple:
0.8
0.6
0.4
0.2
1 2 3 4
Ift2421 34 Chapitre 4
Interpolation par les splines cubiques
Q1 ( x ) = a1 ( x − x1 ) 3 + b1 ( x − x1 ) 2 + c1 ( x − x1 ) + d1
Q2 ( x ) = a 2 ( x − x 2 ) 3 + b2 ( x − x2 ) 2 + c2 ( x − x2 ) + d 2
...
Qi ( x ) = a i ( x − xi ) 3 + bi ( x − xi ) 2 + ci ( x − xi ) + d i
...
Qn−1 ( x ) = a n−1 ( x − xn−1 ) 3 + bn−1 ( x − xn−1 ) 2 + cn−1 ( x − x n−1 ) + d n−1
Ift2421 35 Chapitre 4
Condition 1 : Continuité des fonctions.
y1 = Q1 ( x1 )
y2 = Q1 ( x2 ) = Q2 ( x2 )
...
yi = Qi −1 ( xi ) = Qi ( xi )
...
yn−1 = Qn −2 ( xn−1 ) = Qn−1 ( xn−1 )
yn = Qn−1 ( xn )
Ift2421 36 Chapitre 4
Condition 3 : Continuité des dérivées secondes.
a. i =1
S1 = Q1′′( x1 )
Q1 ( x ) = a1 ( x − x1 ) 3 + b1 ( x − x1 ) 2 + c1 ( x − x1 ) + d1
Q1′′( x ) = 6a1 ( x − x1 ) + 2b1
∴ S1 = 2b1
S1
∴ b1 = 2 pour i =1 (1)
b. i = 2, ... , n-1
Si = Qi′′−1 ( xi ) = Qi′′( xi )
Qi ( x ) = a i ( x − xi ) 3 + bi ( x − xi ) 2 + ci ( x − xi ) + d i
Qi′′( x) = 6ai ( x − xi ) + 2bi
∴ Si = Qi′′( x ) = 2bi
Si
∴ bi = 2 pour i =2, ... , n-1 (2)
Ift2421 37 Chapitre 4
Qi −1 ( x ) = ai −1 ( x − xi −1 ) 3 + bi −1 ( x − xi −1 ) 2 + ci −1 ( x − xi −1 ) + d i −1
Qi′′−1 ( x) = 6ai −1 ( x − xi −1 ) + 2bi −1
∴ Si = Qi′′−1 ( xi ) = Qi′′( xi )
Si = 6ai −1hi −1 + 2bi −1 or 2bi −1 = Si −1
Si − Si −1
ai −1 = pour i =2, ... , n-1 (4)
6hi −1
∴ S1 , S2 ,Κ , Sn−1 ⇒ a1 , a2 ,Κ , an− 2
c. i = n
Qn−1 ( x ) = a n−1 ( x − xn−1 ) 3 + bn−1 ( x − x n−1 ) 2 + cn−1 ( x − x n−1 ) + d n−1
S n − S n−1
∴ a n−1 = 6hn−1 pour i =n (5)
Ift2421 38 Chapitre 4
Condition 1 : Continuité des fonctions.
a. i =1
y1 = Q1 ( x1 )
Q1 ( x ) = a1 ( x − x1 ) 3 + b1 ( x − x1 ) 2 + c1 ( x − x1 ) + d1
∴ d1 = y1 pour i =1 (8)
b. i = 2, ... , n-1
yi = Qi −1 ( xi ) = Qi ( xi )
Qi ( x ) = a i ( x − xi ) 3 + bi ( x − xi ) 2 + ci ( x − xi ) + d i
∴ y1 , y2 ,Κ , yn−1 ⇒ d1 , d 2 ,Κ , d n −1
de même:
Qi −1 ( x ) = ai −1 ( x − xi −1 ) 3 + bi −1 ( x − xi −1 ) 2 + ci −1 ( x − xi −1 ) + d i −1
Ift2421 39 Chapitre 4
c. i = n
yn = Qn−1 ( xn )
Qn−1 ( x ) = an−1 ( x − xn−1 ) 3 + bn−1 ( x − xn−1 ) 2 + cn−1 ( x − xn−1 ) + d n−1
ou bien
∴ yi +1 = ai hi + bi hi + ci hi + d i
3 2
pour i =1, ... , n-1 (14)
dans (14) substituons ai, bi di par (3), (7), (10) et isolons Ci:
yi +1 − yi 2hi Si + hi Si +1
ci = − pour i =1, ... , n-1 (15)
hi 6
∴ S1 , S2 ,Κ , Sn ⇒ c1 , c2 ,Κ , cn −1
Ift2421 40 Chapitre 4
Condition 2 : Continuité des dérivées premières.
Il ne reste donc qu'à trouver S1, S2, ... , Sn
a. i =1
Q1′( x1 ) ( = y1′ notation)
Q1 ( x ) = a1 ( x − x1 ) 3 + b1 ( x − x1 ) 2 + c1 ( x − x1 ) + d1
b. i = 2, ... , n-1
Ift2421 41 Chapitre 4
c. i = n
yn′ = Qn′−1 ( xn )
Ift2421 42 Chapitre 4
Dans (22), utilisons les formules (3), (7) et (15):
Si
∴ bi = 2 pour i =1, ... , n-1 (3)
Si +1 − Si
ai = pour i =1, 2, ... , n-1 (7)
6hi
yi +1 − yi 2hi Si + hi Si +1
ci = − pour i =1, ... , n-1 (15)
hi 6
yi +1 − yi 2hi Si + hi Si +1 S − Si −1 2
− = 3( i )hi −1
hi 6 6hi −1
Si −1
+2( )h
2 i −1
y − yi −1
+ i
hi −1
2hi −1 Si −1 + hi −1 Si
−
6
yi +1 − yi yi − yi −1
h S
∴ i −1 i −1 + ( 2 hi −1 + 2 hi ) S i + h S
i i +1 = 6 −
hi hi −1
Ift2421 43 Chapitre 4
Nous avons un système de (n-2) équations
à n inconnues S1, ... , Sn à résoudre.
y − y2 y2 − y1
i=2 h1S1 + 2(h1 + h2 ) S2 + h2 S3 = 6 3 −
h2 h1
y − y3 y3 − y2
i=3 h2 S2 + 2(h2 + h3 ) S3 + h3 S4 = 6 4 −
h3 h2
y − y4 y4 − y3
i=4 h3 S3 + 2(h3 + h4 ) S4 + h4 S5 = 6 5 −
h4 h3
y − yn −1 yn −1 − yn − 2
i = n −1 hn − 2 Sn − 2 + 2(hn − 2 + hn −1 ) Sn −1 + hn −1Sn = 6 n −
hn −1 hn − 2
x x S 2 z2
x x x 0 S z
3 3
x x x S 4 z4
x x x ⋅ Μ = Μ
Ο Ο Ο Μ Μ
Ο Ο Ο Μ Μ
0 x x x S n−2 zn−2
x x Sn −1 zn−1
⇒ S1 , S2 ,Κ , Sn ⇒ ai , bi , ci , d i ⇒ Qi ( x)
Ift2421 44 Chapitre 4
Les coefficients de chaque polynôme de degré 3
Q1 ( x ) = a1 ( x − x1 ) 3 + b1 ( x − x1 ) 2 + c1 ( x − x1 ) + d1
Q2 ( x ) = a 2 ( x − x 2 ) 3 + b2 ( x − x2 ) 2 + c2 ( x − x2 ) + d 2
...
Qi ( x ) = a i ( x − xi ) 3 + bi ( x − xi ) 2 + ci ( x − xi ) + d i
...
Qn−1 ( x ) = a n−1 ( x − xn−1 ) 3 + bn−1 ( x − xn−1 ) 2 + cn−1 ( x − x n−1 ) + d n−1
(S i +1 − Si )
ai =
6 hi
Si
bi =
2
yi +1 − yi (2 Si + S i +1 )hi
ci = −
hi 6
d i = yi
Ift2421 45 Chapitre 4
Splines cubiques : Conditions frontières
S1 = 0
Sn = 0
Ift2421 46 Chapitre 4
Exemple :
Faire passer une spline cubique naturelle par les points suivants :
i 1 2 3 4
xi 1 2 3 4
f(xi) 4 -2 3 1
Spline naturelle : S1 = 0 et S4 = 0
y3 − y2 y2 − y1
6 −
2(h1 + h2 ) h2 S2 h2 h1
h + ⋅ S = y − y y3 − y2
2 ( h h3 3
)
−
2 2
6
4 3
h3 h 2
4 1 S 2 6[(3 + 2) − ( −2 − 4)]
1 4 ⋅ S =
3 6[ (1 − 3) − ( 3 + 2 ) ]
4 1 S 2 66
1 4 ⋅ S = − 42
3
S1 = 0, S2 = 20.4, S3 = -15.6 et S4 = 0
Ift2421 47 Chapitre 4
a1 =
( S 2 − S1 ) S1
, b1 = ,
6
Q1(x)
6 h1 2
y2 − y1 (2 S1 + S 2 )h1
4
c1 = − ,
h1 6 2
d 1 = y1
a1 = 3.4, b1 = 0, c1 = −9.4, d1 = 4 0
1 2 3 4
Q1 ( x ) = 3.4( x − 1) 3 − 9.4( x − 1) -2
+4
=
(S 3 − S2 ) S
6
a2 , b2 = 2 ,
6 h2 2
4
y3 − y2 (2 S 2 + S 3 )h2
c2 = − ,
h2 6 2
d 2 = y2
a 2 = −6, b2 = 10.2, c2 = 0.8,
0
1 2 3 4
d 2 = −2
-2
Q2 ( x ) = −6( x − 2) 3 + 10.2( x − 2) 2
Q2(x)
+ 0.8( x − 2) − 2
Ift2421 48 Chapitre 4
a3 =
( S 4 − S3 ) S3
, b3 = ,
6
6 h3 2 4
y4 − y3 (2 S 3 + S 4 )h3
c3 = − ,
h3 6 2
d 3 = y3
a3 = 2.6,b3 = −7.8, c3 = 32
. ,d3 = 3 0
1 2 3 4
Q3 ( x ) = 2.6( x − 3) 3 − 7.8( x − 3) 2
-2
Q3(x)
+ 3.2( x − 3) + 3
Q1(x)
0
1 2 3 4
-2
Q3(x) Q2(x)
Ift2421 49 Chapitre 4
2. nous ajoutons les 2 conditions : Type 2
S1 = S2
Sn = Sn-1
y − y2 y2 − y1
(3h1 + 2h2 ) S 2 + h2 S 3 = 6 3 −
h2 h1
y − yn −1 y n−1 − yn −2
hn −2 S n −2 + (2hn −2 + 3hn−1 ) S n −1 = 6 n −
hn −1 h n −2
Exemple (suite)
S1 = S2 = 15.5
S3 = S4 = -11.5
Ift2421 50 Chapitre 4
3. nous ajoutons les 2 conditions : Type 3
S1 = Extrapolation linéaire de S2 et S3
Sn = Extrapolation linéaire de Sn-2 et Sn-1
Ift2421 51 Chapitre 4
4. nous imposons des valeurs aux pentes des extrémités Type 4
Q1 ( x ) = a1 ( x − x1 ) 3 + b1 ( x − x1 ) 2 + c1 ( x − x1 ) + d1
Q1′( x1 ) = c1 = y1′
y 2 − y1 (2 S1 + S 2 )h1
− = y1′
h1 6
h1 h1 y2 − y1
S + S = − y1′ (a)
3 1 6 2 h1
Ift2421 52 Chapitre 4
De même
hn−1 h y − yn −1
S n−1 + n−1 S n = yn′ − n (b)
6 3 hn −1
Ift2421 53 Chapitre 4
Exemple :
10
5
y
i
interp( dl , x , y , x2 )
interp( dp , x , y , x2 )
interp( dc, x , y , x2 )
0
5
0 1 2 3 4 5 6 7 8
x , x2
i
Ift2421 54 Chapitre 4
Interpolation par les splines cubiques
Algorithme de résolution de système tridiagonal
1. Factorisation :
ai ,1
ai , 2 = ai , 2 − ai −1,3 ai ,1 = 0 pour i = 2,Κ , n
ai −1,2
ai ,1
ai , 4 = ai , 4 − ai −1,4 ai , 3 = ai , 3
ai −1,2
2. Substitution arrière :
an ,4
an ,4 = pour i = n − 1,Κ ,1
an ,2
ai ,4 − ai ,3 * ai +1,4
a i ,4 =
ai , 2
Ift2421 55 Chapitre 4
Les lignes courbes : Courbes de Bézier
i =0 i i i !(n − i )!
Représentation paramétrique :
x (u)
p(u) = avec 0 ≤ u ≤ 1
y (u)
Ift2421 56 Chapitre 4
xi
avec pi = y 0 ≤ i ≤ n (n+1 points)
i
Remarque :
k
BEZ k ,k (u) = (1 − u) k − k u k = u k
k
k
BEZ 0,k (u) = (1 − u) k −0 u 0 = (1 − u) k
0
Ift2421 57 Chapitre 4
Courbes de Bézier cubiques :
BEZ 0,3 = (1 − u) 3
BEZ1,3 (u) = 3u(1 − u) 2
BEZ2 ,3 (u) = 3u 2 (1 − u)
BEZ 3,3 (u) = u 3
donc
x (u) = (1 − u) 3 x0 + 3u(1 − u) 2 x1 + 3u 2 (1 − u) x2 + u 3 x3
y (u) = (1 − u) 3 y0 + 3u(1 − u) 2 y1 + 3u 2 (1 − u) y2 + u 3 y3
Ift2421 58 Chapitre 4
Propriétés des courbes de Bézier :
p(0) = p0
p(1) = pn
dx dy
3. À u = 0, du = 3( x1 − x 0 ) et du = 3( y1 − y0 )
dy ( y1 − y0 )
La pente de la courbe à u = 0 est dx = ( x − x ) .
1 0
C'est la pente de la droite passant par p0 et p1.
Ift2421 59 Chapitre 4
Ift2421 60 Chapitre 4
P2, P3 et P4 ne sont pas alignés.
Ift2421 61 Chapitre 4
Ift2421 62 Chapitre 4
Représentation matricielle des courbes de Bézier cubiques :
n
n n n!
P(u) = ∑ (1 − u) n−i u i pi avec =
i =0 i i i !(n − i )!
−1 3 − 3 1 p0
3 −6 3 0 p
P(u) = [ u 3 , u 2 , u,1] 1
− 3 3 0 0 p2
1 0 0 0 p3
P(u) = u T M Bez p
Ift2421 63 Chapitre 4
Exemple d'utilisation des courbes de Bézier :
Courbe Fermée:
Ift2421 64 Chapitre 4
Les Surfaces courbes de Bézier: 3D
m n
P(u, v ) = ∑ ∑ p j ,k BEZ j ,m (v ) BEZ k ,n (u)
j =0 k =0
y (u , v ) = [u 1] M [v 1]
3 T
u2 u T
Bez Y M Bez
3
v2 v
z ( u, v ) = [u 1] M [v 1]
3 2 T 3 2 T
u u Bez ZM Bez v v
x 0, 0 x0,1 x 0,2 x 0, 3
x x1,1 x1,2 x1,3
X =
1, 0
avec
x 2 ,0 x2 ,1 x 2 ,2 x2 ,3
x 3,0 x3,1 x 3,2 x 3,3
Ift2421 65 Chapitre 4
Les lignes courbes: Courbe B-Spline cubique
B-Spline cubique:
Ift2421 66 Chapitre 4
Comme pour les splines cubiques, les mêmes contraintes de
continuité sont utilisées pour joindre les segments de B-Splines.
Ift2421 67 Chapitre 4
L’équation paramétrique d’une B-Spline cubique est :
2
Bi (u) = ∑b
k =−1
k pi + k avec
Ift2421 68 Chapitre 4
Représentation matricielle des courbes de B-Splines
cubiques :
2
Bi (u) = ∑b
k =−1
k pi + k
−1 3 − 3 1 pi −1
3 0 pi
1 3 2 1 3 −6
Bi (u) = [ u , u , u ,1]
6 − 3 0 3 0 pi +1
1 4 1 0 i +2
p
uT Mb p
Bi (u) =
6
Ift2421 69 Chapitre 4
Passer par les extrémités dans les courbes B-Splines
cubiques :
Démonstration :
−1 3 − 3 1 pi −1
3 0 pi
1 3 2 1 3 −6
Bi (u) = [ u , u , u ,1]
6 − 3 0 3 0 pi +1
1 4 1 0 i +2
p
Ift2421 70 Chapitre 4
Évaluons cette équation pour le nouveau premier segment c-à-d
B-1 en posant p-2 = p-1 = p0 alors :
−1 3 − 3 1 p−2
3 0 p−1
1 3 2 1 3 −6
B−1 (u) = [ u , u , u ,1]
6 − 3 0 3 0 p0
1 4 1 0 p1
−1 3 − 3 1 p0
3 0 p0
1 3 2 1 3 −6
B−1 (u) = [ u , u , u ,1]
6 − 3 0 3 0 p0
1 4 1 0 p1
1
B−1 (u) = ( p1 − p0 ) u 3 + p0
6
Ift2421 71 Chapitre 4
Ift2421 72 Chapitre 4
Joindre 2 courbes B-Spline:
p2 , p3 et p4 sont alignés
Ift2421 73 Chapitre 4
Les Surfaces courbes B-Spline : 3D
x ( u, v ) =
1 3
36
[ ]
u u 2 u 1 M b X i , j M bT v 3 v 2 v 1
T
[ ]
y( u , v ) =
1 3
36
[ ]
u u 2 u 1 M b Yi , j M bT v 3 v 2 v 1
T
[ ]
z( u , v ) =
1 3
36
[ ]
u u 2 u 1 M b Zi , j M bT v 3 v 2 v 1
T
[ ]
xi −1, j −1 xi −1, j xi −1, j +1 xi −1, j +2
x xi , j xi , j +1 xi , j + 2
=
i , j −1
avec X i, j
xi +1, j −1 xi +1, j xi +1, j +1 xi +1, j +2
xi +2 , j −1 xi + 2 , j xi +2 , j +1 xi + 2 , j + 2
Ift2421 74 Chapitre 4
Interpolation de surfaces par des surfaces
polynomiales de collocation
z = f ( x , y ) = e x Sin( y ) + y − 01
.
2 approches possibles :
Ift2421 75 Chapitre 4
1. Interpoler directement la fonction au point considéré.
0.5 y
12 0.4
0.3
0.2
11 0.1
4
8
4 7 10 3
z
Ensemble de points
3 6 2
9
2
5 1
1 0
3
2
1 x
0
x
3
1 2 12
0
4
11
C
8 10 3
Pour x constant,
7
interpolation en y. B 9
4 6
2 z
3
A 2 5
1
1
0.5 0
0.4 0.3 0.2 0.1
y
Ift2421 76 Chapitre 4
Interpolation en x pour y = 1.6
0.5 y
12 0.4
0.3
0.2
11 0.1
4
8
C
4 7 10 3
X
B z
3 6 2
9
A
2
5 1
1 0
3
2
1 x
0
0.5 12
0.4
y0.3
0.2
0.14
11
8
3 C
10
7
4
X
B
z 2 3 6
9
A
2
5
1 1
0
0 1 2 3
x
Ift2421 77 Chapitre 4
Interpolation en y
y z ∆z ∆ 2z ∆ 3z
0.2 0.640
0.363
0.3 1.003 -0.007
x = 0.1 0.356 -0.005
0.4 1.359 -0.012
0.344
0.5 1.703
0.2 0.990
0.534
0.3 1.524 -0.013
x = 1.5 0.521 -0.004
0.4 2.045 -0.017
0.504
0.5 2.549
0.2 1.568
0.816
0.3 2.384 -0.023
x = 2.0 0.793 -0.004
0.4 3.177 -0.027
0.766
0.5 3.943
Étape 1 :
x = 1.0
S S 2 S 3
z = P3 ( y ) = z0 + ∆z0 + ∆ z0 + ∆ z0
1 2 3
S=(y-y0)/h = (0.33-0.2)/0.1 = 1.3
P3(0.33) = 0.640+1.3*0.363+1.3*0.3*(-0.007)/2+1.3*0.3*(-
0.7)(-0.005)/6
P3(0.33) = 1.1108
Ift2421 78 Chapitre 4
x = 1.5
P3(0.33) = 1.6818
x = 2.0
P3(0.33) = 2.6245
Étape 2 :
Interpolation en x
x z ∆z ∆ 2z ∆ 3z
1.0 1.1108
0.5710
y= 0.33 1.5 1.6818 0.3717
0.9427
2.0 2.6245
S S 2
z = P2 ( x) = z0 + ∆z0 + ∆ z0
1 2
x − x 0 16
. − 10.
S= = = 12
.
h 0.5
z = P2(1.6)0.33 = 1.8406
Ift2421 79 Chapitre 4
2. Calculer l'équation de la surface de collocation et utiliser
l’équation de cette surface.
0.5 y
12 0.4
0.3
0.2
11 0.1
4
8
4 7 10 3
3 z
6 2
9
2
5 1
1 0
3
2
1 x
0
Ift2421 80 Chapitre 4
Ift 2421
Chapitre 4
Interpolation
polynomiale :
Moindres carrés
Ift2421 81 Chapitre 4
Introduction
Ti (°C) Ri (ohms)
20.5 765
32.7 826
51.0 873
73.2 942
95.7 1032
R=aT+b
Ift2421 82 Chapitre 4
Lissage par moindres carrés
But :
Ift2421 83 Chapitre 4
Lissage par moindres carrés
(régression linéaire)
Soit ei = Yi - yi
m
R2 = ∑ ei 2
i =1
m m
R2 = ∑ (Yi − yi ) = ∑ (Yi − a xi − b) 2 = R2 (a , b)
2
i =1 i =1
∑ ( (Y − a x
i =1
i i − b)( − xi ) = 0
m
∑ ( (Y − a x
i =1
i i − b)( − 1) = 0
a ∑ xi2 + b ∑ xi = ∑ xi yi
⇒ a, b : y=ax + b
∑ i
Équations Normales a x + b m = ∑ yi
Ift2421 84 Chapitre 4
Lissage par moindres carrés
(régression linéaire)
Exemple :
Ti (°C) Ri (ohms) Ti2 Ti Ri
20.5 765
32.7 826
51.0 873
73.2 942
95.7 1032
Total : 273.1 4438 18607.27 254932.5
Ift2421 85 Chapitre 4
Remarque : les problèmes de ce type peuvent aussi être résolus
par la méthode des systèmes surdéterminés.
y1 = ax1 + b x1 1 y1
y 2 = ax 2 + b x 1 a y 2
⇔ 2 = ⇒ A T Ax = A T b
Μ Μ
1 b Μ
y m = ax m + b xm 1 ym
x1 1 y1
x1 x2 Κ x m x 2 1 a x1 x2 Κ xm y 2
1 ⋅ ⋅ = ⋅
1 1 Μ b 1
1
1
m
x 1 ym
∑ xi2 ∑ x ⋅ a = ∑ x y
i i i
∑ xi m b ∑ y i
a ∑ xi2 + b ∑ xi = ∑ xi yi
a ∑ xi + b m = ∑ yi
Ift2421 86 Chapitre 4
Lissage par moindres carrés
(régression non linéaire)
Polynôme
Pn(x) = a0 + a1 x + a2 x2 + ... + an xn
Soit ei = Yi - Pn(xi)
R2 = ∑ ei = ∑ Yi − PN ( xi ) ( )
m m
2
2
i =1 i =1
Minimum pour :
∂R2 m
= ∑ 2(Yi − PN ( xi ))( − xi j ) = 0
∂a j i =1
m m m
m
∑ 1 ∑x ∑= ∑ i
N
i Κ x a
i x
im=1 i =1 i 1
0 i m=1
x
m m
∑ i ∑x 2
i Κ ∑= xiN +1 ⋅ a1 = ∑ xi yi
Κ
i =1 i =1 i 1
Κ Κ
i =1
Κ Κ Κ
m m m a N m
∑ xiN ∑x N +1
Κ ∑ xi
2N
∑ xi yi N
i =1 i =1
i
i =1 i =1
Ift2421 87 Chapitre 4
Lissage par moindres carrés
(régression non linéaire)
Différent d’un polynôme
Autre formes :
1. y = a xb
2. y = a ebx
Changement de variables :
z = ln(y)
w = ln(x)
2. ln(y) = ln(a) + b x
Modifications qui conduisent à la méthode linéaire :
z=A+bx
Ift2421 88 Chapitre 4
Exemple : Régression en y = a ebx avec la table :
2. ln(y) = ln(a) + b x
x z = ln(y) x2 x ln(y)
1 0.693 1 0.693
2 1.974 4 3.948
4 6.215 16 24.859
∑ xi2 ∑ xi ⋅ b = ∑ xi zi
600
∑ xi m A ∑ zi
500
400
21 7 b 29.5
7 3 ⋅ A = 8.882
300
200
b 188 b = 188
100
. .
A = − 1427 ⇒ a = e −1.427 = 0.24
.
0
1 2 3 4
Ift2421 89 Chapitre 4
Autres méthodes de lissage
R∞ = max ei
1≤i ≤ m
m
R1 = ∑ ei
i =1
Ift2421 90 Chapitre 4