300 likes | 1.22k Views
. . . . . . . . . xi-3 xi-2 xi-1 xi xi 1 xi 2 xi 3. . . . . Evenly distributed points along the x-axis. . . . . . x1 x2 x3 . Unevenly distributed points along the x-axis. Distance between two neighboring points is the same, i.e. h..
E N D
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
4. Forward difference
5. Forward difference
6. Backward difference
7. Centered difference
8. First Derivatives Forward difference
Backward difference
Central difference
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(h2)
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
17. Example: First Derivatives Use forward and backward difference approximations of O(h2) 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(h2)
More nodal points are needed for higher derivatives
Higher order formula may be derived
19. 19.3 Richardson Extrapolation
20. Example of using Richardson ExtrapolationCentral Difference Scheme
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
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. MATLABs Methods Derivatives are sensitive to the noise
Use least square fit before taking derivatives
p = polyfit(x, y, n) - coefficients of Pn(x)
polyfit(p, x) - evaluation of Pn(x)
polyder(p) - differentiation