Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 19 Numerical Differentiation §Estimate the derivatives (slope, curvature, etc.) of a function by using the function values at only a set of discrete.

Similar presentations


Presentation on theme: "Chapter 19 Numerical Differentiation §Estimate the derivatives (slope, curvature, etc.) of a function by using the function values at only a set of discrete."— Presentation transcript:

1 Chapter 19 Numerical Differentiation §Estimate the derivatives (slope, curvature, etc.) of a function by using the function values at only a set of discrete points §Ordinary differential equation (ODE) §Partial differential equation (PDE) §Represent the function by Taylor polynomials or Lagrange interpolation §Evaluate the derivatives of the interpolation polynomial at selected (unevenly distributed) nodal points

2

3 x i-3 x i-2 x i-1 x i x i+1 x i+2 x i+3 Evenly distributed points along the x-axis x 1 x 2 x 3 Unevenly distributed points along the x-axis Distance between two neighboring points is the same, i.e. h.

4 Forward difference Backward difference Centered difference Numerical Differentiation

5 Forward difference x i  1 x i x i+1 x h True derivative Approximation

6 Backward difference x i  1 x i x i+1 x h True derivative Approximation

7 Centered difference x i  1 x i x i+1 x 2h True derivative Approximation

8 First Derivatives §Forward difference §Backward difference §Central difference i-2 i-1 i i+1 i+2 x y

9 Truncation Errors §Uniform grid spacing

10 Example: First Derivatives §Use forward and backward difference approximations to estimate the first derivative of at x = 0.5 with h = 0.5 and 0.25 (exact sol. = -0.9125) §Forward Difference §Backward Difference

11 Example: First Derivative §Use central difference approximation to estimate the first derivative of at x = 0.5 with h = 0.5 and 0.25 (exact sol. = -0.9125) §Central Difference

12 Second-Derivatives §Taylor-series expansion §Uniform grid spacing §Second-order accurate O(h 2 )

13 Centered Finite-Divided Differences

14 Forward Finite-divided differences

15 Backward finite-divided differences

16 First Derivatives §3 -point Forward difference §3 -point Backward difference i-2 i-1 i i+1 i+2 Parabolic curve

17 Example: First Derivatives §Use forward and backward difference approximations of O(h 2 ) to estimate the first derivative of at x = 0.5 with h = 0.25 (exact sol. = -0.9125) §Forward Difference §Backward Difference

18 Higher Derivatives §All second-order accurate O(h 2 ) §More nodal points are needed for higher derivatives §Higher order formula may be derived

19 19.3 Richardson Extrapolation D is the true value but unknown and D(h 1 ) is an approximation based on the step size h 1. Reducing the step size to half, h 2 =h 1 /2, we obtained another approximation D(h 2 ). By properly combining the two approximations, D(h 1 ) & D(h 2 ), the error is reduced to O(h 4 ).

20 Example of using Richardson Extrapolation Central Difference Scheme By combining the two approximations, D(h/2) & D(h), the error of f’(h) is reduced to O(h 4 ).

21 Ex19.2: Richardson Extrapolation §Use central difference approximation to estimate the first derivative of at x = 0.5 with h = 0.5 and 0.25 (exact sol. = -0.9125)

22 General Three-Point Formula  Lagrange interpolation polynomial for unequally spaced data

23 Lagrange Interpolation §1st-order Lagrange polynomial §Second-order Lagrange polynomial

24 Lagrange Interpolation §Third-order Lagrange polynomial

25 Lagrange Interpolation L 1 (x)f(x 1 ) L 2 (x)f(x 2 ) L 0 (x)f(x 0 ) x0x0 x1x1 x2x2

26 General Three-Point Formula  Lagrange interpolation polynomial for unequally spaced data  First derivative

27 Second Derivative §First Derivative for unequally spaced data §Second Derivative for unequally spaced data

28 Differentiation of Noisy Data

29 MATLAB’s Methods §Derivatives are sensitive to the noise §Use least square fit before taking derivatives §p = polyfit(x, y, n) - coefficients of P n (x) §polyfit(p, x) - evaluation of P n (x) §polyder(p) - differentiation


Download ppt "Chapter 19 Numerical Differentiation §Estimate the derivatives (slope, curvature, etc.) of a function by using the function values at only a set of discrete."

Similar presentations


Ads by Google