240 likes | 678 Views
Chapter 7. Numerical Differentiation: 1* Lecture (II). 1* Ref: “Applied Numerical Methods with MATLAB for Engineers and Scientists”, Steven Chapra, 2 nd ed., Ch. 19 , McGraw Hill, 2008. Outline. Numerical differentiation (2) High-accuracy differentiation formulas
E N D
Chapter 7 Numerical Differentiation:1* Lecture (II) 1* Ref: “Applied Numerical Methods with MATLAB for Engineers and Scientists”, Steven Chapra, 2nd ed., Ch. 19, McGraw Hill, 2008.
Outline • Numerical differentiation • (2) High-accuracy differentiation formulas • (3) Derivatives of unequally spaced data
High-accuracy differentiation formulas • High-accuracy finite-difference formulas can be generated by including additional terms from the Taylor series expansion. • An example: High-accuracy forward-difference formula for the first derivative (see derivation on the next slide)
Forward Taylor series expansion Solve for f’(x) Substitute the forward-difference approx. of f”(x) High-accuracy forward-difference formula Accuracy improved to O(h2) Derivation: High-accuracy forward-difference formula for f’(x)
Forward finite-difference formulas • Note: Two versions • Upper: Basic • Lower: High-accuracy
Backward finite-difference formulas • Note: Two versions • Upper: Basic • Lower: High-accuracy
Centered finite-difference formulas • Note: Two versions • Upper: Basic • Lower: High-accuracy
Example • Example 19.1 (Ref.): Repeat the computation in Example 4.4 to estimate f’(x) at x = 0.5 with a step size h = 0.25. Employ the high-accuracy formulas for the forward, centered, and backward-difference approximations. f(x) = -0.1x4 – 0.15x3 – 0.5x2 – 0.25x + 1.2
Results (Example 19.1) True value: f’(0.5) = -0.9125 High-Accuracy formulas Basic formulas
Derivatives of unequally spaced data • Experimental data are often measured at unequal intervals. Previous formulas can be used only for equally spaced data. • How to deal with unequally spaced data? • One method: • (i) Fit a Lagrange Interpolating Polynomial to a set of adjacent points that bracket the point at which the derivative needs to be evaluated; • (ii) Differentiate the Interpolating Polynomial analytically and evaluate the derivate at the required point.
Example • Example 19.3 (Ref.): As in Fig. 19.6, a temperature gradient can be measured down into the soil. The heat flux at the soil-air interface can be computed with Fourier’s law: where q(x) = heat flux (W/m2), k = coefficient of thermal conductivity for soil [=0.5 W/(m·K)], T = temperature (K), and z = distance measured down from the surface into the soil (m). Note that a positive value of the flux means that heat is transferred from the air to the soil. Use numerical differentiation to evaluate the gradient at the soil-air interface and employ this estimate to determine the heat flux into the ground • Answer: f’(0) = -133.333 K/m and q(z = 0) = 66.667 W/m2.