13.07.2015 Views

Lecture 30 ES 301 Engineering Analysis Let's continue our ...

Lecture 30 ES 301 Engineering Analysis Let's continue our ...

Lecture 30 ES 301 Engineering Analysis Let's continue our ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Lecture</strong> <strong>30</strong><strong>ES</strong> <strong>30</strong>1<strong>Engineering</strong> <strong>Analysis</strong>1 of 8Let’s <strong>continue</strong> <strong>our</strong> investigations into methods to numerically approximatethe value of a derivative.In the methods we’ve looked at so far, the interval or step size, h, hasbeen uniform. This is “mathematically nice” and allowed us to derive themethods used.However, when we use empirically (experimentally) derived data to form<strong>our</strong> models, which we often do in engineering practice, there is noguarantee that the design variable data will be evenly spaced. How do wehandle this?o If you recall, we arrived at a similar point when we weredetermining numerical integration methods.o One way to deal with this problem is to first perform some sort ofregression on the empirical data to arrive at an approximationfunction that represents the data. We can then treat this function like we have in the past andnumerically approximate the derivative at any point. However, we only know measured relations between designand object variables at the collected data points. Allinformation in between is approximate and, thus, includessome error. This means that using this approach to approximate thederivative will propagate the error. We’ll have the error dueto the function fit and the error introduced by approximatingthe derivative.lecture<strong>30</strong>.docx


<strong>Lecture</strong> <strong>30</strong><strong>ES</strong> <strong>30</strong>1<strong>Engineering</strong> <strong>Analysis</strong>2 of 8o Another approach, which allows us to use the data as gathered, isto use a 2 nd -order Lagrange Interpolating Polynomial with any threesequential data points. If we are interested in approximating the derivative at somepoint, x, we choose three sequential points form <strong>our</strong> datathat encompass the point of interest. The method uses the following formula to estimate thederivative:f ′i i+1i−1i+1( x) ≅ f ( xi−1) + f ( x ) ( )( )ix − x x − x ( x − x )( x − x )i−12x− x − xii−1i+12x− xii−1− xii+1+fi−1i( xi+1) ( x − x )( x − x )i+12x− xi−1− xi+1io Let’s look at an example. One of the problems in building in extreme cold climates isdealing with permafrost (permanently frozen ground).• The problem is, as the soil freezes and thaws it tendsto move due to ice/water volume changes.• Another problem is the load carrying capacity of thesoil. Frozen ground will carry a high load. But, if theground is made of silt, loam, or other weak soils,when the ground thaws it can no longer carry theload.lecture<strong>30</strong>.docx


<strong>Lecture</strong> <strong>30</strong><strong>ES</strong> <strong>30</strong>1<strong>Engineering</strong> <strong>Analysis</strong>3 of 8 To deal with this problem, engineers need to understand theheat transfer between the air and ground and the resultingtemperature distribution within the ground w.r.t. time. Example 23.3 of the text talks about this problem briefly. Quite often we will bury a string of temperature sensors(thermocouples, RTDs, or thermistors) in the ground andgather temperature data vs. depth in the ground over time to“get a handle” on the temperature gradient within the groundat a given location under “typical” climatic conditions. Since the temperature difference is due to the heat transferbetween the ground surface and the soil, and the soil acts asan insulator for the ground below it, the greater swings intemperature occur close to the surface. Therefore, if I’m developing an experimental setup tocharacterize ground temperature, I will likely space thesensors closer together near the surface where I expect tosee a more rapid change w.r.t. depth.Problem:I bury a string of thermistors in the ground and record thetemperatures every h<strong>our</strong> for a year. The data for oneparticular h<strong>our</strong> is shown in the table below. I wish to knowthe temperature gradient near the surface (@1.5 ft down)and below the active layer (@ 25 ft down).Depth [ft] Temp [°F]0 2.00.5 2.51 4.5lecture<strong>30</strong>.docx


<strong>Lecture</strong> <strong>30</strong><strong>ES</strong> <strong>30</strong>1<strong>Engineering</strong> <strong>Analysis</strong>4 of 82 8.03 12.04 15.05 20.010 <strong>30</strong>.020 32.0<strong>30</strong> 35.040 35.0Solution:We’ll apply the method we just introduced.For the near surface approximation of the derivative(gradient), we want an estimate at x = 1.5. Our 3 points forthe formula will be at depths of: 1.0, 0.5, & 2.0.From the data:x = 1.5x = 1.0 f ( ) = 4. 5ix f ( x i−1) = 2. 5i−1 = 0.5x f ( x i+1) = 8. 0i+1 = 2.0x iSubstituting into the formula:f+2( ) ( )( 1.5)−1.0− 2.0′ 1.5 ≅ 2.5( 0.5 −1)( 0.5 − 2.0)2( )( 1.5)− 0.5 −1.08.0= 3.5( 2.0 − 0.5)( 2.0 −1.0)+2( )( 1.5)− 0.5 − 2.01.0( 1.0 − 0.5)( 1.0 − 2.0)For the gradient at depth (x = 25.0), we obtain the following:x = 25.0x = 20.0 f ( ) = 32. 0ix f ( x i−1) = <strong>30</strong>. 0i−1 = 10.0x ilecture<strong>30</strong>.docx


<strong>Lecture</strong> <strong>30</strong><strong>ES</strong> <strong>30</strong>1<strong>Engineering</strong> <strong>Analysis</strong>5 of 8x f ( x i+1) = 35. 0i+1 = <strong>30</strong>.0Substituting into the formula:f+2( ) ( )( 25)− 20 − <strong>30</strong>′ 25.0 ≅ <strong>30</strong>( 10 − 20)( 10 − <strong>30</strong>)2( )( 25)−10− 2035= 0.<strong>30</strong>( <strong>30</strong> −10)( <strong>30</strong> − 20)+2( )( 25)−10− <strong>30</strong>32( 20 −10)( 20 − <strong>30</strong>)Matlab’s built-in res<strong>our</strong>ces to numerically differentiate are rather limited.o In Simulink, there are two constructs to find the derivative w.r.t.time. These include the Derivative and Discrete Derivative blocks. These are not functions or m-files as we’ve seen in thisclass. These are blocks which are constructs within theSimulink modeling environment. Their use is beyond the scope of this class.o Within Matlab, we can get very rough estimates of the derivativeusing diff(). The argument passed to diff() is a vector. diff() simply takes the difference between each two adjacentelements.lecture<strong>30</strong>.docx


<strong>Lecture</strong> <strong>30</strong><strong>ES</strong> <strong>30</strong>1<strong>Engineering</strong> <strong>Analysis</strong>6 of 8 The following Matlab session uses diff() to approximate thederivative for the depth/temperature data given in <strong>our</strong>example problem:>> x = [0 0.5 1 2 3 4 5 10 20 <strong>30</strong> 40];>> f = [2.0 2.5 4.5 8.0 12.0 15.0 20.0 <strong>30</strong>.0 32.0 35.0 35.0];>> diff(f)./diff(x)ans =Columns 1 through 81.0000 4.0000 3.5000 4.0000 3.0000 5.0000 2.0000 0.2000Columns 9 through 100.<strong>30</strong>00 0• We see very rough agreement between the resultsdisplayed here and those we calculated earlier usingthe Lagrange Interpolation Formula.• The Lagrange Interpolation is based on a 3-point fit.So, it is much more accurate (several orders ofmagnitude) than the simple point-by-point differenceapproximation given by diff().Let’s look at a couple of examples to finish up <strong>our</strong> coverage of numericalapproximations of the derivative.Problem:Compute the central difference approximation of the 1 stf( x) sin( x)= @x = π with4the true error of this approximation?derivative ofh = π at the O(h124 ) accuracy level. What islecture<strong>30</strong>.docx


<strong>Lecture</strong> <strong>30</strong><strong>ES</strong> <strong>30</strong>1<strong>Engineering</strong> <strong>Analysis</strong>7 of 8Solution:First find the analytical solution:( x) = cos ( x) ⇒ f ′( π ) = cos( ) = 0. 7071f ′ π4 4The central divided difference formula is:f ′( x )i−=f( x ) + f ( x ) − 8 f ( x ) f ( x )Determining the values:@ x@ x@ x@ xi−i−ii+i+ 28i+1i−1+i−212h⎛ π π ⎞2⇒ sin⎜− 2 ⎟ = 0.2588⎝ 4 12 ⎠⎛ π π ⎞1⇒ sin⎜− ⎟ = 0.5000⎝ 4 12 ⎠⎛π⎞⇒ sin⎜⎟ = 0.7071⎝ 4 ⎠⎛ π π ⎞1⇒ sin⎜+ ⎟ = 0.8660⎝ 4 12 ⎠⎛ π π ⎞@ xi+2⇒ sin⎜+ 2 ⎟ = 0.9659⎝ 4 12 ⎠Substituting:f ′( )x i−=And the error:et( 0.9659) + 8( 0.8660) − 8( 0.5000) + ( 0.2588)12( π )120.7071−0.7069=× 100 = 0.03%0.7071= 0.7069Problem:Use Richardson Extrapolation to approximate the 1 stf( x) sin( x)= @x = π with4h1= π &3difference formulas at the O(h 2 ) level of accuracy.derivative ofh2= π . Use centered finite6lecture<strong>30</strong>.docx


<strong>Lecture</strong> <strong>30</strong><strong>ES</strong> <strong>30</strong>1<strong>Engineering</strong> <strong>Analysis</strong>8 of 8Solution:First find the centered finite difference approximation for each step size:⎛π⎞ fD⎜⎟ =⎝ 3 ⎠( ) ( ) sin( π + π ) − sin( π − πx)i + 1− f xi−1=4 3 4 32h2( π )3= 0.5848et=0.7071−0.58480.7071× 100 = 17.<strong>30</strong>%⎛π⎞D⎜⎟ =⎝ 6 ⎠f( ) ( ) sin( π + π ) − sin( π − πx)i + 1− f xi−1=4 6 4 62h2( π )6= 0.6752et=0.7071−0.67520.7071× 100 = 4.51%D =4313( 0.6752) − ( 0.5848) = 0. 7053Thus, the error is:et=0.7071−0.7053× 100 = 0.25%0.7071A much better approximation than we obtained from either of thecomponent approximations.lecture<strong>30</strong>.docx

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!