 ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 22 CURVE FITTING Chapter 18 Function Interpolation and Approximation.

Presentation on theme: "ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 22 CURVE FITTING Chapter 18 Function Interpolation and Approximation."— Presentation transcript:

ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 22 CURVE FITTING Chapter 18 Function Interpolation and Approximation

LAST TIME Curve Fitting Often we are faced with the problem… what value of y corresponds to x=0.935?

LAST TIME Curve Fitting Question 1 : Is it possible to find a simple and convenient formula that reproduces the points exactly? e.g. Straight Line ? …or smooth line ? …or some other representation? Interpolation

LAST TIME Curve Fitting Question 2 : Is it possible to find a simple and convenient formula that represents data approximately ? e.g. Best Fit ? Approximation

LAST TIME Function Interpolation Linear Interpolation Simplest Form is to connect data points with a straight line (1 st Order Polynomial) x

LAST TIME Linear Interpolation Slope of Line 1 st DIVIDED DIFFERENCE f [x i+1,x i ] First order interpolating polynomial

LAST TIME Function Interpolation Higher Order Interpolation Newton Interpolating Polynomials x

Last Time General Form of Newton’s Interpolating Polynomials

Divided Differences Given a Set of Data xf(x) xoxo f(x o ) x1x1 f(x 1 ) x2x2 f(x 2 ) …… xnxn f(x n )

Last Time Example

Lagrange Interpolating Polynomials Reformulation of Newton’s Polynomials Avoid Calculation of Divided Differences xf(x) xoxo f(x o ) x1x1 f(x 1 ) x2x2 f(x 2 ) …… xnxn f(x n )

Lagrange Interpolating Polynomial Cardinal Functions: Product of n-1 linear factors Skip x i Property:

Example Write cardinal functions and give the Lagrange interpolating polynomial for

Errors in Polynomial Interpolation It is expected that as number of nodes increases, error decreases, HOWEVER…. At all interpolation nodes x i Error=0 At all intermediate points Error: f(x)-f n-1 (x) f(x)

Errors in Polynomial Interpolation Beware of Oscillations…. For Example: Consider f(x)=(1+x 2 ) -1 evaluated at 9 points in [-5,5] And corresponding p 8 (x) Lagrange Interpolating Polynomial P 8 (x) f(x)

Download ppt "ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 22 CURVE FITTING Chapter 18 Function Interpolation and Approximation."

Similar presentations