Presentation is loading. Please wait.

Presentation is loading. Please wait.

Curve Fitting and Interpolation: Lecture (I)

Similar presentations


Presentation on theme: "Curve Fitting and Interpolation: Lecture (I)"— Presentation transcript:

1 Curve Fitting and Interpolation: Lecture (I)
Chapter 5 Curve Fitting and Interpolation: Lecture (I) Dr. Jie Zou PHY 3320

2 Outline Introduction Engineering applications
Curve Fitting? Interpolation? Engineering applications Measurement of damping in a fluid Measurement of the dependence of air resistance on velocity in a wind tunnel experiment Collocation-Polynomial fit Interpolation (1) Lagrange interpolation formula Dr. Jie Zou PHY 3320

3 Introduction Curve fitting? – To fit a smooth and continuous function (curve) to the available discrete data. A familiar example: In the Free-fall lab in General Physics I, you are asked to fit a function (quadratic) to the data of position v.s. time. Two approaches: Collocation: The approximating function passes through all the data points. Usually used when the data are known to be accurate. Least-square regression: The approximating curve represents the general trend of the data. Usually used when the data appear to have significant error. Figure 5.1 Collocation-Fitting polynomials Dr. Jie Zou PHY 3320

4 Introduction (cont.) Interpolation? – The process of estimating an intermediate value from a set of discrete (or tabulated) values. The collocation function is often called an interpolating function. Polynomial interpolation is most commonly used. Others: trigonometric or exponential function. Different forms of Polynomial interpolation Lagrange interpolation-Lecture (I) Newton forward or backward interpolation-Lecture (II) Dr. Jie Zou PHY 3320

5 Engineering applications
Example 5.1: An experiment to measure the damping of a solid body in a fluid. Dr. Jie Zou PHY 3320

6 Available Data Points t (s) 0.0 1.5 3.7 5.2 7.1 9.6 11.8  (deg) 110.0 77.5 44.7 31.5 20.1 11.6 7.0 Assuming an exponential function to fit the data: (t) = a ebt. Determine a and b use certain curve fitting technique. Dr. Jie Zou PHY 3320

7 Engineering applications (cont.)
Wind tunnel experiment to measure how the force of air resistance depends on velocity. Dr. Jie Zou PHY 3320

8 Available Data Points Assuming a polynomial quadratic fit: Fu = cdv2.
v (m/s) 10 20 30 40 50 60 70 80 F (N) 25 380 550 610 1220 830 1450 Assuming a polynomial quadratic fit: Fu = cdv2. Determine cd use certain curve fitting technique Dr. Jie Zou PHY 3320

9 Collocation-Polynomial Fit
Available data points: (xi,yi), i=0,1,2, ,n. Consider a polynomial of order n: f(x)=y=a0+a1x+a2x2++an-1xn-1+anxn. Let the polynomial passes through all the points (xi,yi); a system of (n+1) linear algebraic equations; (n+1) unknown coefficients a0, a1, ,an: yi=a0+a1xi+a2xi2++an-1xin-1+anxin, i=0,1,2, ,n. The matrix form: [B]a=y, where We can use Gauss Elimination to solve for ai’s. Dr. Jie Zou PHY 3320

10 Example 5.4 The data on the voltage e (V) v.s. time t (s) in an circuit are given by the following: t = 0, s, and 0.01 s; e = 0, 110 V, and 0 V. Choose a polynomial to exactly fit the data. (1) Find the coefficients using MATLAB built-in functions (code) (2) Find the coefficients using Gauss Elimination (Code) (3) Plot both the discrete data points and the polynomial fitting function on the same graph. (4) Check if the fitting curve pass through all the date points. Dr. Jie Zou PHY 3320

11 Interpolation-(1) Lagrange Interpolation Formula
Example: Three data points (xi, yi), i=0,1,2. Basic idea: Express the polynomial in an alternative way f(x)=y=a0(x-x1)(x-x2) +a1(x-x0)(x-x2) +a2(x-x0)(x-x1) Set f(xi) = yi, we have y0 =a0(x0-x1)(x0-x2), y1=a1(x1-x0)(x1-x2), and y2 = a2(x2-x0)(x2-x1) Easy Solution for ai, i=0,1,2 (see next slide). Dr. Jie Zou PHY 3320

12 Lagrange Interpolation Formula (cont.)
Dr. Jie Zou PHY 3320

13 Example 5.5 (a) Develop a Lagrange interpolation polynomial that passes through the points (0,0), (0.005,110), and (0.01,0). (b) Evaluate the function at an intermediate point x = or 2.5x10-3. (1) By hand. (2) Write an M-file MyLagrange.m. A copy of the code will be handed out later. Dr. Jie Zou PHY 3320


Download ppt "Curve Fitting and Interpolation: Lecture (I)"

Similar presentations


Ads by Google