This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Numerical Differentiation and Integration • Numeric Differentiation Topics (Tues 3/3): – Finite difference formulas • Forward, Backward and Central Finite Difference • 2 nd derivatives • diff function – Curve fitting before taking derivative olyder nction (sec 8.1.4) 3/03/2009 1 • polyder function (sec 8.1.4) – MATLAB builtin function for numeric differentiation: gradient – Partial differentiation • Numerical Integration topics (Tue 3/17) MASE201 Spring 2009 Definition of the derivative • The derivative of f ( x ) is defined as: • An approximation to the derivative improves as x approaches a : a x a f x f a f dx x df a x a x − − = ′ = → = ) ( ) ( lim ) ( ) ( 3/03/2009 2 MASE201 Spring 2009 Figure 64 reproduced from Gilat and Subramaniam, “Numerical Methods for Engineers and Scientists.”, Wiley, 2008. Why use numerical differentiation? • Want to find derivative of a measured quantity (discrete points) – Find maximum or inimum 20 30 40 50 60 nd dy/dx measured y dy/dx 3/03/2009 3 minimum – Numerically solve differential equations – Fit rate data 2 4 6302010 10 x values y and MASE201 Spring 2009 Noise and Scatter • When using experimental data, it often has uncertainties (noise) or scatter. Calculation of derivatives can be very sensitive to 1.5 2 2.5 3 f/dt Noise and numerical differentiation 3/03/2009 4 noise. 2 4 6 8 100.5 0.5 1 time f(t), df/ f(t) df/dt noisy data numerical approx. to df/dt MASE201 Spring 2009 Numerical Differentiation • Taylor series expansion of a function about a point x o he quantity ) called the remainder: ( ) ( ) ( ) ( ) ) ( ! ! 3 ! 2 ) ( ) ( 2 3 3 3 2 2 2 x R dx f d n x x dx f d x x dx f d x x dx df x x x f x f n n n o o o o o o x x o x x o x x o x x + − + + − + − + − + = = = = = K 3/03/2009 5 • The quantity R n (x) is called the remainder: • If we expand the series for n = 1: ( ) ( ) ξ = = − + − + = x o x x dx f d x x dx df x x x f x f o o o 2 2 2 ! 2 ) ( ) ( ( ) ( ) x x dx f d n x x x R o n n n o n x ≤ ≤ + − = = + + + ξ ξ where ! 1 ) ( 1 1 1 MASE201 Spring 2009 Numerical Differentiation • If the remainder is ignored: and solving for the approximate derivative: • Since the series expansion was truncated, this ( ) o x x dx df x x x f x f o o = − + ≈ ) ( ) ( ( ) o o x x x f x f dx df o x x − − ≈ = ) ( ) ( 3/03/2009 6 approximation has a truncation error equal to ( ) ! 2 ) ( 2 2 2 1 ξ = − = x dx f d x x x R o MASE201 Spring 2009 Finite Difference Approximations • For a set of data, let x o = x i , and x = x i+1 : or let x o = x i , and x = x i1 : i i i i i i i x x h h x f x f x f − = − ≈ ′ + + 1 1 where ) ( ) ( ) ( 1 1 1 where ) ( ) ( ) (...
View
Full
Document
This document was uploaded on 05/05/2010.
 Spring '10

Click to edit the document details