1 / 35

Chapter 8 Interpolation (1)

Chapter 8 Interpolation (1). Table of Contents. 8.1 Polynomial Interpolation 8.1.1 Lagrange Interpolation 8.1.2 Newton Interpolation 8.1.3 Difficulties with Polynomial Interpolation 8.2 Hermite Interpolation 8.3 Rational-Function Interpolation. Lagrange Interpolation Polynomials.

bernad
Download Presentation

Chapter 8 Interpolation (1)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 8Interpolation (1) Copyleft  2005 by MediaLab

  2. Table of Contents • 8.1 Polynomial Interpolation • 8.1.1 Lagrange Interpolation • 8.1.2 Newton Interpolation • 8.1.3 Difficulties with Polynomial Interpolation • 8.2 Hermite Interpolation • 8.3 Rational-Function Interpolation Copyleft  2005 by MediaLab

  3. Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through the n points. • Using given several point, we can find Lagrange interpolation polynomial. Copyleft  2005 by MediaLab

  4. General Form of Lagrange • The general form of the polynomial is p(x) = L1y1 + L2y2 + … + Lnyn where the given points are (x1,y1), ….. , (xn,yn). • The equation of the line passing through two points (x1,y1) and (x2,y2) is • The equation of the parabola passing through three points (x1,y1), (x2,y2), and (x3,y3) is • http://math.fullerton.edu/mathews/n2003/lagrangepoly/LagrangePolyProof.pdf Copyleft  2005 by MediaLab

  5. Example of Lagrange Interpolation • Example • Given points (x1,y1)=(-2,4), (x2,y2)=(0,2), (x3,y3)=(2,8) Copyleft  2005 by MediaLab

  6. MATLAB Function for Lagrange Interpolation • We can represent the Lagrange polynomial with coefficient ck. • p(x)=c1N1+c2N2+ … +cnNn Copyleft  2005 by MediaLab

  7. Higher Order Interpolation Polynomials • Higher order interpolation polynomials x = [ -2 -1 0 1 2 3 4], y = [ -15 0 3 0 -3 0 15] Copyleft  2005 by MediaLab

  8. Review and Discussion • In Lagrange interpolation polynomial, it always go through given points. Think with equation below • The Lagrange form of polynomial is convenient when the same abscissas may occur in different applications. • It is less convenient than the Newton form when additional data points may be added to the problem. Copyleft  2005 by MediaLab

  9. Newton Interpolation Polynomials • Newton form of the equation of a straight line passing through two points (x1, y1) and (x2, y2) is • Newton form of the equation of a parabola passing through three points (x1, y1), (x2, y2), and (x3, y3) is • the general form of the polynomial passing through n points (x1, y1), …,(xn, yn) is Copyleft  2005 by MediaLab

  10. Newton Interpolation Polynomials (cont’d) • Substituting (x1, y1) into • Substituting (x2, y2) into • Substituting (x3, y3) into Copyleft  2005 by MediaLab

  11. Newton Interpolation Parabola • Passing through the points (x1, y1)=(-2, 4), (x2, y2)=(0, 2), and (x3, y3)=(2, 8). • The equations is • Where the coefficients are • thus Copyleft  2005 by MediaLab

  12. Newton Interpolation Parabola (cont’d) • Passing through the points (x1, y1)=(-2, 4), (x2, y2)=(0, 2), and (x3, y3)=(2, 8). Copyleft  2005 by MediaLab

  13. Additional Data Points • We extend the previous example, adding the points (x4, y4) = (-1, -1) and (x5, y5) = (1, 1) • Divided-difference table becomes (with new entries shown in bold) • Newton interpolation polynomial is Copyleft  2005 by MediaLab

  14. Higher Order Interpolation Polynomials • Consider again the data from Example 8.4 with Lagrange form. x = [ -2 -1 0 1 2 3 4 ], y = [ -15 0 3 0 -3 0 15] • Do it again with Newton form. That the polynomial is cubic is clear. Copyleft  2005 by MediaLab

  15. Higher Order Interpolation Polynomials (cont’d) • If the y values are modified slightly, the divided-difference table shows the small contribution from the higher degree terms: Copyleft  2005 by MediaLab

  16. MATLAB functions – Finding the coefficients >> x = [-2 -1 0 1 2 3 4]; >> y = [-15 0 3 0 -3 0 15]; >> Newton_Coef(x,y); d = 15 -6 1 0 0 0 3 -3 1 0 0 0 -3 0 1 0 0 0 -3 3 1 0 0 0 3 6 0 0 0 0 15 0 0 0 0 0 >> function a = Newton_Coef(x, y) n = length(x); %Calculate coeffiecients of Newton interpolating polynomial a(1) = y(1); for k=1 : n-1 d(k,1) = (y(k+1) - y(k))/(x(k+1) - x(k)); %1st divided diff end for j=2 : n-1 for k=1 : n-j d(k,j) = (d(k+1,j-1) - d(k,j-1))/(x(k+j) - x(k)); %jth divided diff end end d for j=2:n a(j) = d(1, j-1); end Copyleft  2005 by MediaLab

  17. MATLAB functions – Evaluate the polynomials >> a = [-15 15 -6 1 0 0 0]; >> x = [-2 -1 0 1 2 3 4]; >> t = [0 1 2]; >> Newton_Eval(t, x, a); t = 0 1 2 p = 3 0 -3 function p = Newton_Eval(t,x,a) % t : input value of the polynomial (x) % x : x values of interpolating points % a : answer of previous MATLAB function, i.e, the coefficients of Newton polynomial. n = length(x); hold on; for i =1 : length(t) ddd(1) = 1; %Compute first term c(1) = a(1); for j=2 : n ddd(j) = (t(i) - x(j-1)).*ddd(j-1); % Compute jth term c(j) = a(j).*ddd(j); end; p(i) = sum(c); %plot(t(i),p(i)); grid on; end t p Copyleft  2005 by MediaLab

  18. Humped and Flat Data • The data • x = [ -2 -1.5 -1 -0.5 0 – 0.5 1 1.5 2] • y = [ 0 0 0 0.87 1 0.87 0 0 0] illustrate the difficulty with using higher order polynomials to interpolate a moderately large number of points. Copyleft  2005 by MediaLab

  19. Noisy Straight Line • The data • x = [ 0.00 0.20 0.80 1.00 1.20 1.90 2.00 2.10 2.95 3.00] • y = [ 0.01 0.22 0.76 1.03 1.18 1.94 2.01 2.08 2.90 2.95] • Not well suited with noisy straight line. Copyleft  2005 by MediaLab

  20. Runge Function • The function is a famous example of the fact that polynomial interpolation does not produce a good approximation for some functions and that using more function values (at evenly spaced x values) does not necessarily improve the situation. • Example 1. • x = [ -1 -0.5 0.0 0.5 1.0 ] • y = [0.0385 0.1379 1.0000 0.1379 0.0385] Copyleft  2005 by MediaLab

  21. Runge Function (cont’d) • Example 2. • x = [-1.000 -0.750 -0.500 -0.250 0.000 0.250 0.500 0.750 1.000 ] • y = [0.0385 0.0664 0.138 0.3902 1.000 0.3902 0.138 0.0664 0.0385] • The interpolation polynomial overshoots the true polynomial muchmore severely than the polynomial formed by using only five points. Copyleft  2005 by MediaLab

  22. 8.2Hermite Interpolation Copyleft  2005 by MediaLab

  23. Hermite Interpolation • Hermite interpolation allows us to find a ploynomial that matched both function value and some of the derivative values Copyleft  2005 by MediaLab

  24. More data for Product concentration Copyleft  2005 by MediaLab

  25. MATLAB Code for Hermite interpolation Copyleft  2005 by MediaLab

  26. Difficult Data • As with lower order polynomial interpolation, trying to interpolate in humped and flat regions cause overshoots. Copyleft  2005 by MediaLab

  27. 8.3Rational-Function Interpolation Copyleft  2005 by MediaLab

  28. Rational-Function Interpolation • Why use rational-function interpolation? • Some functions are not well approximated by polynomials.(runge-function) • but are well approximated by rational functions, that is quotients of polynomials. Copyleft  2005 by MediaLab

  29. Bulirsch-Stoer algorithm • Bulirsch-Stoer algorithm • The approach is recursive, based on tabulated data(in a manner similar to that for the Newton form of polynomial interpolation). • Given a set of m+1 data points (x1,y1), … , (xm+1, ym+1), we seek an interpolation function of the form <Bulirsch-Stoer algorithm general pattern> The proof is in J.Stoer and R.Bulirsch, 'Introduction to Numerical Analysis' Copyleft  2005 by MediaLab

  30. Bulirsch-Stoer algorithm(cont’d) • Bulirsch-Stoer method for three data points Copyleft  2005 by MediaLab

  31. Third stage Second stage data First stage x1 y1 R1= y1 x2 y2 R2= y2 x3 y3 R3=y3 x4 y4 R4=y4 x5 y5 R5=y5 Bulirsch-Stoer algorithm(cont’d) • Bulirsch-Stoer method for five data points Copyleft  2005 by MediaLab

  32. Fifth stage Forth stage Bulirsch-Stoer algorithm(cont’d) Copyleft  2005 by MediaLab

  33. Bulirsch-Stoer Rational-Function(cont’d) Copyleft  2005 by MediaLab

  34. Example 8.13 rational-function interpolation data points: x = [-1 -0.5 0.0 0.5 1.0] y = [0.0385 0.1379 1.0000 0.1379 0.0385] Copyleft  2005 by MediaLab

  35. Example 8.13 rational-function interpolation(cont’d) Copyleft  2005 by MediaLab

More Related