We solve a0 a0 114 1 5 25 1 a1 8 1 7 49 a1 23 3 1

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lab lagpoly.m Example. Find the interpolating polynomial through the points (5, 1), (−7,−23) (−6, −54) using standard basis functions and Lagrange polynomials. Answer. 3 data points = polynomial of degree 2 Standard basis functions: Let p(x) = a0 + a1 x + a2 x2 . We solve ⎤ ⎤⎡ ⎤ ⎡ ⎤ ⎡⎤ ⎡ ⎡ a0 a0 −114 1 5 25 1 ⎣a1 ⎦ = ⎣ −8 ⎦ ⎣1 −7 49⎦ ⎣a1 ⎦ = ⎣−23⎦ =⇒ 3 1 −6 36 −54 a2 a2 Thus p(x) = −114 − 8x + 3x2 . Lagrange polynomials: (x − (−7))(x − (−6)) 1 = (x + 7)(x + 6) (5 − (−7))(5 − (−6)) 132 (x − 5)(x − (−6)) 1 = (x − 5)(x + 6) 1 ( x) = (−7 − 5)(−7 − (−6)) 12 (x − 5)(x − (−7)) 1 = − (x − 5)(x + 7) 2 ( x) = (−6 − 5)(−6 − (−7)) 11 0 ( x) Thus p(x) = = 0 (x) − 23 1 (x) − 54 2 (x). 3 (This equals p(x) = −114 − 8x +3x2 .) Equally spaced points (or nodes) On [a, b], xj = a + jh for j = 0, . . . , n, with h = Runge’s example: f (x) = 1 1+25x2 b −a n on [−1, 1] Large error near end points Error grows as degree increases! Chebyshev points Choose xj to minimize maxx∈[−1,1] n j =1 (x − xj ) On [−1, 1], tj = cos( 2n2+1−2j π ) for j = 0, . . . , n n+2 On [a, b], xj = a+b 2 + b −a t 2j for j = 0, . . . , n Chebyshev nodes are the zeros of the Chebyshev polynomial Tn+1 (x) of the first kind of degree n + 1 (details omitted) Interpolation error is minimized by choosing Chebyshev nodes We can also represent the interpolating polynomial using Chebyshev polynomials Ti (x) for i = 0, . . . , n as basis functions (details omitted) Example. See the plots on the bottom of page 1 and Matlab finterp.m. 4...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online