Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 17 and 18 Interpolation.

Similar presentations


Presentation on theme: "Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 17 and 18 Interpolation."— Presentation transcript:

1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 17 and 18 Interpolation

2 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Part Organization Chapter 14 –Brief Review of Statistics –Linear Regression (How to determine the best fit) Chapter 15 –Polynomial Regression –Multiple Linear Regression Chapter 16 – Skip Chapter 17 – Polynomical Interpolation Chapter 18 – Spline Interpolation 2 Focus on built-in MATLAB techniques

3 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. What if you have closely spaced accurate data – how do you figure out intermediate points? Two techniques are : –Polynomial Interpolation –Spline Interpolation

4 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 1 st order polynomial

5 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5

6 6 2 nd order polynomial

7 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 7

8 8 3 rd order polynomial

9 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9

10 10 4 th order polynomial

11 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 11

12 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 12 One downside of polynomial interpolation is that higher order polynomials are ‘ill conditioned’ and may exhibit wild oscillations

13 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. US Population Model 13 Example from Forsythe, Malcolm and Moler 8 data points

14 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Extrapolation is especially problematic with higher order polynomials

15 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Linear Spline Interpolation Assume the function between any two points is a straight line

16 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. How do you find a point in between? X=2, Y=?

17 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Interpolated Point Interpolated Points Linear Interpolation – Connect the points with a straight line to find y This is a linear spline

18 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. MATLAB Code interp1 is the MATLAB function for spline interpolation It defaults to linear spline interpolation First define an array of x and y Now define a new x array, that includes the x values for which you want to find y values new_y=interp1(x,y,x_new)

19 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

20

21 Both measured data points and interpolated data were plotted on the same graph. The original points were modified in the interactive plotting function to make them solid circles. knots Linear splines have discontinuous first derivatives at the knots

22 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Other Interpolating Polynomials We could model each section of the graph as a higher order polynomial. Instead of a straight line we could assume a parabola (quadratic – ie 2 nd order) fit or a cubic fit (3 rd order). 22

23 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Cubic Spline A cubic spline creates a smooth curve, using a third degree polynomial 1 st and 2 nd derivatives are equal at the ‘knots’

24 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 24

25 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. We can get an improved estimate by using the spline interpolation technique

26 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27 Cubic Spline Interpolation. The data points on the smooth curve were calculated. The data points on the straight line segments were measured. Note that every measured point also falls on the curved line. Continuous 1 st and 2 nd derivatives at the knots

28 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Other Interpolation Techniques MATLAB includes other interpolation techniques including –Nearest Neighbor –Cubic Use the help function to find out more if you are interested

29 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Multidimensional Interpolation interp2(x,y,z,x i,y i ) interp3(x,y,z,w,x i,y i,z i ) 29 The same ‘method’ options are available for these functions as for interp1

30 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. An example taken from the interp2 windowed help 10 years20 years30 years 1950150.697199.592187.625 1960179.323195.072250.287 1970203.212179.092322.767 1980226.505153.706426.730 1990249.633120.281598.243 30 Find the wage for someone with 15 years service in 1975

31 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 31

32 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Summary Interpolating Polynomials –Fitting data with a polynomial that goes through all the points Spline Interpolating –Linear --- ‘linear’ –Cubic --- ‘spline’ –Multidimensional Spline interpolating


Download ppt "Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 17 and 18 Interpolation."

Similar presentations


Ads by Google