Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this document? Why not share!

07 interpolationnewton

on

  • 848 views

 

Statistics

Views

Total Views
848
Views on SlideShare
845
Embed Views
3

Actions

Likes
0
Downloads
20
Comments
0

1 Embed 3

http://wikicourses.wikispaces.com 3

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    07 interpolationnewton 07 interpolationnewton Document Transcript

    • Interpolation/Curve Fitting ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Objectives • Understanding the difference between regression and interpolation • Knowing how to “best fit” a polynomial into a set of data • Knowing how to use a polynomial to interpolate data ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Measured Data ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Polynomial Fit! ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Line Fit! ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Which is better? ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Curve Fitting • If the data measured is of high accuracy and it is required to estimate the values of the function between the given points, then, polynomial interpolation is the best choice. • If the measurements are expected to be of low accuracy, or the number of measured points is too large, regression would be the best choice. ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Interpolation ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Why Interpolation? • When the accuracy of your measurements are ensured • When you have discrete values for a function (numerical solutions, digital systems, etc …) ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Acquired Data ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • But, how to get the equation of a function that passes by all the data you have! ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Equation of a Line: Revision y = a0 + a1 x If you have two points y1 = a0 + a1 x1 1 x1  a0   y1  y2 = a0 + a1 x2 1 x   a  =  y   2  1   2 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Solving for the constants! x2 y1 − x1 y2 y2 − y1 a0 = & a1 = x2 − x1 x2 − x1 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik What if I have more than two points? • We may fit a polynomial of order one less that the number of points we have. i.e. four points give third order polynomial. ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Third-Order Polynomial y = a0 + a1 x + a2 x 2 + a3 x 3 For the four points 2 3 y1 = a0 + a1 x1 + a2 x1 + a3 x1 2 3 y2 = a0 + a1 x2 + a2 x2 + a3 x2 2 3 y3 = a0 + a1 x3 + a2 x3 + a3 x3 2 3 y4 = a0 + a1 x4 + a2 x4 + a3 x4 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik In Matrix Form 1 x1 x12 x13  a0   y1   2 3     1 x2 x2 x2   a1   y2  1 2 3  =  x3 x2 x3  a 2   y3   3 1  x4 2 x2 x4  a3   y4      Solve the above equation for the constants of the polynomial. ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Example • Find a 3rd order x Y polynomial to interpolate the -1 1 function described by the given points 0 2 1 5 2 16 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Solution: System of equations • A third order polynomial is given by: f (x ) = a1 + a2 x + a3 x 2 + a4 x 3 f (− 1) = a1 − a2 + a3 − a4 = 1 f (0) = a1 = 2 f (1) = a1 + a2 + a3 + a4 = 5 f (2 ) = a1 + 2a2 + 4a3 + 8a4 = 16 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • In matrix form 1 − 1 1 − 1  a1   1   a1  2 a  1  1 0  0 0  a 2   2    =    2        =  1 1 1 1  a3   5  a3  1    a4  1  1 2 4 8  a4  16         f (x ) = 2 + x + x 2 + x 3 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Newton's Interpolation Polynomial ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Newton’s Method • In the previous procedure, we needed to solve a system of linear equations for the unknown constants. • This method suggests that we may just proceed with the values of x & y we have to get the constants without setting a set of equations • The method is similar to Taylor’s expansion without differentiation! ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik For the two points y = b0 + b1 ( x − x1 ) y1 = b0 + b1 ( x1 − x1 ) ⇒ y1 = b0 y2 = b0 + b1 ( x2 − x1 ) ⇒ y2 = y1 + b1 ( x2 − x1 ) ⇒ b1 = ( y2 − y1 ) (x2 − x1 ) y −y  y = y1 +  2 1 ( x − x1 )  x −x   2 1 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Homework • Show that the polynomial obtained by solving a set of equations is equivalent to that obtained by Newton method ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik For the three points f ( x ) = b1 + b2 ( x − x1 ) +b3 ( x − x1 )( x − x2 ) b0 = y1 y2 − y1 b1 = x2 − x1 y3 − y2 y2 − y1 − x3 − x2 x2 − x1 b2 = x3 − x1 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Using a table xi yi x1 y1 y2 − y1 y3 − y2 y2 − y1 − x3 − x2 x2 − x1 x2 − x1 x3 − x1 x2 y2 y3 − y 2 x3 − x2 x3 y3 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik In General • Newton’s Interpolation is performed for an nth order polynomial as follows f ( x ) = b0 + b1 (x − x1 ) + b2 ( x − x1 )(x − x2 ) +... + bn ( x − x1 )...( x − xn ) ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Example • Find a 3rd order x Y polynomial to interpolate the -1 1 function described by the given points using 0 2 Newton’s method 1 5 2 16 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Newton’s Method • Newton’s methods defines the polynomial in the form: f ( x ) = b0 + b1 ( x − x1 ) + b2 ( x − x1 )( x − x2 ) +b3 ( x − x1 )( x − x2 )( x − x3 ) f ( x ) = b0 + b1 ( x + 1) + b2 ( x + 1)( x ) +b3 ( x + 1)( x )( x − 1) ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Newton’s Method x Y -1 1 1 1 1 0 2 3 4 1 5 11 2 16 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Newton’s Method • Finally: f ( x ) = 1 + ( x + 1) + ( x + 1)( x ) +( x + 1)( x )( x − 1) ( ) ( f ( x ) = 1 + ( x + 1) + x 2 + x + x 3 − x ) f (x ) = 2 + x + x 2 + x 3 ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik
    • Advantage of Newton’s Method • The main advantage of Newton’s method is that you do not need to invert a matrix! ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik Homework #6 • Chapter 18, pp. 505-506, numbers: 18.1, 18.2, 18.3, 18.5. ENEM602 Spring 2007 Dr. Eng. Mohammad Tawfik