21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

121 x = ( a : ( b−a ) / 1 0 0 : b ) ;<br />

122 pb = ( ya ∗(b−x ) .^2 + 2∗w∗( x−a ) . ∗ ( b−x ) +yb ∗( x−a ) . ^ 2 ) / ( ( b−a ) ^2) ;<br />

123 plot ( x , pb , ’ r−’ , ’ l i n e w i d t h ’ ,2) ;<br />

124<br />

125 plot ( p ( j ) , ya , ’ go ’ ) ;<br />

126 end<br />

127<br />

128 % replot initial nodes over the other plots:<br />

129 plot ( t , y , ’ k∗ ’ ) ;<br />

130 % plot(p,yb,’go’)<br />

131 legend ( [ h p l o t ( 1 ) , h p l o t s l ( 1 ) , h p l o t ( 2 : 4 ) ] , leg ) ;<br />

132 t i t l e ( ’ Shape preserving i n t e r p o l a t i o n ’ )<br />

A proof of Weierstrass approximation theorem (see [9, Sect. 6.2]):<br />

✬<br />

Theorem 9.5.1 (Approximation by Bernstein polynomials). If f ∈ C([0, 1]) and<br />

p n (t) := ∑ ( )<br />

n n<br />

j=0 f(j/n) t j (1 − t) n−j , 0 ≤ t ≤ 1 ,<br />

j<br />

then p n → f uniformly for n → ∞. When f ∈ C m ([0, 1]), then p (k)<br />

n → f (k) , 0 ≤ k ≤ m,<br />

uniformly for n → ∞.<br />

✫<br />

Example 9.5.1 (Bernstein approximation).<br />

{<br />

0 , if |2t − 1| > 1 f 1 (t) :=<br />

2 ,<br />

1<br />

1<br />

2 (1 + cos(2π(2t − 1))) otherwise , f 2 (t) :=<br />

1 + e −12(x−1/2) .<br />

✩<br />

✪<br />

9.5 Bezier Techniques<br />

Norms of the approximation errors f − p n , p n from Thm. 9.5.1:<br />

Ôº º<br />

Goal: Curves approximation (not interpolation) by piecewise polynomials<br />

A page from the XFIG-manual (http://www.xfig.org/):<br />

About Spline Curves<br />

||f−p n<br />

|| ∞<br />

||f−p n<br />

|| ∞<br />

Ôº½ º<br />

A Spline curve is a smooth curve controlled by specified points.<br />

||f−p n<br />

|| 2<br />

||f−p n<br />

|| 2<br />

- CLOSED APPROXIMATING SPLINE: Smooth closed curve which approximates specified<br />

points.<br />

- OPEN APPROXIMATING SPLINE: Smooth curve which approximates specified points.<br />

- CLOSED INTERPOLATING SPLINE: Smooth closed curve which passes through specified<br />

points.<br />

- OPEN INTERPOLATING SPLINE: Smooth curve which passes through specified points.<br />

Error norm<br />

10 0 Polynomial degree n<br />

10 −1<br />

Error norm<br />

10 0 Polynomial degree n<br />

10 −1<br />

10 −2<br />

10 −2<br />

10 −3<br />

10 0 10 1 10 2<br />

Bernstein approximation of f 1 Bernstein approximation of f 2<br />

10 0 10 1 10 2<br />

Using splines, curves such as the following may be easily drawn.<br />

Ôº¼ º<br />

Ôº¾ º

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!