Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
y i+1<br />
t i−1 t i t i+1<br />
y i−1<br />
y i<br />
y i−1<br />
y i−1<br />
y i<br />
y i+1<br />
y i+1 y i<br />
t i−1 t i t i+1 t i−1 t i t i+1<br />
➁ Choice of “middle points” p i ∈ (t i−1 ,t i ], i = 1,...,n:<br />
⎧<br />
intersection of the two straight lines<br />
⎪⎨<br />
resp. through (t<br />
p i =<br />
i−1 ,y i−1 ), (t i , y i ) if the intersection point belongs to (t i−1 , t i ] ,<br />
with slopes c i−1 ,c i ⎪⎩ 1<br />
2 (t i−1 + t i ) otherwise .<br />
This points will be used to build the grid for the final quadratic spline:<br />
M = {t 0 < p 1 ≤ t 1 < p 2 ≤ · · · < p n ≤ t n }.<br />
Ôº¿ º<br />
l “inherits” local monotonicity and curvature from the data.<br />
Example 9.4.6 (Auxiliary construction for shape preserving quadratic spline interpolation).<br />
Data points: t=(0:12); y = cos(t);<br />
y<br />
1<br />
0.8<br />
0.6<br />
0.4<br />
0.2<br />
0<br />
−0.2<br />
−0.4<br />
−0.6<br />
−0.8<br />
−1<br />
0 2 4 6 8 10 12<br />
t<br />
Local slopes c i , i = 0, ...,n<br />
y<br />
Linear auxiliary spline l<br />
1<br />
0.8<br />
0.6<br />
0.4<br />
0.2<br />
0<br />
−0.2<br />
−0.4<br />
−0.6<br />
−0.8<br />
−1<br />
0 2 4 6 8 10 12<br />
t<br />
Ôº¿ º<br />
➃ Local quadratic approximation / interpolation of l:<br />
Linear auxiliary spline l<br />
✸<br />
If g is a linear spline through three points (a,y a ), ( 1 2 (a + b), w), (b, y b), a < b, y a ,y b , w ∈ R,<br />
p = (t(1)-1)*ones(1,length(t)-1);<br />
for j=1:n-1<br />
if (c(j) ~= c(j+1))<br />
p(j)=(y(j+1)-y(j)+...<br />
t(j)*c(j)-t(j+1)*c(j+1))/...<br />
(c(j)-c(j+1));<br />
end<br />
if ((p(j)t(j+1)))<br />
p(j) = 0.5*(t(j)+t(j+1));<br />
end;<br />
end<br />
y i−1<br />
y i<br />
t i−1<br />
1<br />
c i−1<br />
l<br />
1<br />
2 (p i + t i−1 )<br />
p i<br />
c i<br />
1<br />
1<br />
2 (p i + t i )<br />
t i<br />
the parabola p(t) := (y a (b − t) 2 + 2w(t − a)(b − t) + y b (t − a) 2 )/(b − a) 2 , a ≤ t ≤ b ,<br />
satisfies p(a) = y a , p(b) = y b , p ′ (a) = g ′ (a) , p ′ (b) = g ′ (b) .<br />
g monotonic increasing / decreasing ⇒ p monotonic increasing / decreasing<br />
g convex / concave ⇒ p convex / concave<br />
y a<br />
Linear Spline l<br />
Parabola p<br />
y a<br />
w<br />
Linear Spline l<br />
Parabola p<br />
w<br />
Linear Spline l<br />
Parabola p<br />
➂ Set l = linear spline on the mesh M ′ (middle points of M)<br />
M ′ = {t 0 < 1 2 (t 0 + p 1 ) < 1 2 (p 1 + t 1 ) < 1 2 (t 1 + p 2 ) < · · · < 1 2 (t n−1 + p n ) < 1 2 (p n + t n ) < t n } ,<br />
with l(t i ) = y i , l ′ (t i ) = c i .<br />
In each interval ( 1 2 (p j + t j ), 1 2 (t j + p j+1 )) the spline corresponds to the segment of slope c j passing<br />
through the data node (t j , y j ).<br />
In each interval ( 1 2 (t j +p j+1 ), 1 2 (p j+1 +t j+1 )) the spline corresponds to the segment connecting the<br />
previous ones.<br />
Ôº¿ º<br />
w<br />
y b<br />
a<br />
1<br />
2 (a + b)<br />
b<br />
y b<br />
a<br />
1<br />
2 (a + b)<br />
b<br />
y a<br />
yb<br />
a<br />
1<br />
2 (a + b)<br />
This implies that the final quadratic spline that passes through the points (t j ,y j ) with slopes c j can<br />
be built locally as p using the linear spline l, in place of g.<br />
b<br />
Ôº¼ º