Docsity

Solutions to Homework Set 8: False Position Method and Physics Problems - Prof. E. Cliff, Assignments of Engineering

Toggle sidebar
bg1
AOE/ESM 2074
H.W. Set 8 - Solution
[2.] In the method of false position we construct an a๏ฌƒne approximation to our function
by using data at the end-points of an interval that includes a change in the sign of the
function. That is, if the interval is [a, b] then we require that f(a)โˆ—f(b)<=0. Valuesof y
along such a line must satisfy
yโˆ’f(a)
xโˆ’a=f(b)โˆ’f(a)
bโˆ’a.
On this line, the value of xwhere y=0isgivenby
x=f(b)โˆ—aโˆ’f(a)โˆ—b
f(b)โˆ’f(a).
We modify the original bisect1.m function, replacing the midpoint formula for the new trial
point by this new result. Our code is available as rfalsi.m.
Nowweusethecodeontheexamplef(x)=1โˆ’xโˆ—exp(x). It is easy to see that f(0) = 1
and that f(2) = 1 โˆ’2โˆ—exp(2) โ‰ˆโˆ’13 so there is a zero-crossing on the interval [0,2].
>fcn = inline(โ€™1-x.*exp(x)โ€™)
fcn =
Inline function:
fcn(x) = 1-x.*exp(x)
>z = r_falsi(fcn,0,2)
z=
0.56713995627537
fcn(z)
ans =
9.212931182500661e-006
1
pf3

Partial preview of the text

Download Solutions to Homework Set 8: False Position Method and Physics Problems - Prof. E. Cliff and more Assignments Engineering in PDF only on Docsity!

AOE/ESM 2074

H.W. Set 8 - Solution

[2.] In the method of false position we construct an affine approximation to our function by using data at the end-points of an interval that includes a change in the sign of the function. That is, if the interval is [a, b] then we require that f (a) โˆ— f (b) <= 0. Values of y along such a line must satisfy

y โˆ’ f (a) x โˆ’ a

f (b) โˆ’ f (a) b โˆ’ a

On this line, the value of x where y = 0 is given by

x =

f (b) โˆ— a โˆ’ f (a) โˆ— b f (b) โˆ’ f (a)

We modify the original bisect1.m function, replacing the midpoint formula for the new trial point by this new result. Our code is available as r falsi.m.

Now we use the code on the example f (x) = 1 โˆ’ x โˆ— exp(x). It is easy to see that f (0) = 1 and that f (2) = 1 โˆ’ 2 โˆ— exp(2) โ‰ˆ โˆ’13 so there is a zero-crossing on the interval [0, 2].

fcn = inline(โ€™1-x.exp(x)โ€™) fcn = Inline function: fcn(x) = 1-x.exp(x)

z = r_falsi(fcn,0,2) z =

fcn(z) ans = 9.212931182500661e-

[3.] The measured time (T ) is the sum of two times: the time for the object to fall from rest to the depth d; and, the time for the sound to propagate back through the same distance. From elementary physics we have

t 1 =

2 d g

and t 2 =

d Vs

Thus, we have

T =

2 d g

d Vs

or ; T โˆ’

2 d g

d Vs

A plot of T as a function of d is shown below.

(^00 10 20 30 40 50 60 70 80 90 )

1

2

3

4

5

Depth (m)

Time (sec)

Time in Well Depth Experiment

We are interested in the inverse function; that is, for a given value of T we want to find d. We provide a Matlab function file well.m to evaluate the second expression. Note that well has two input arguments: the distance d and the measured time T. In our application the latter is a parameter - a value that is fixed for a given problem. We shall use the Matlab function fzero to find the desired root. As an estimate, we use de =. 5 โˆ— g โˆ— T 2 , that is we expect that the time for the sound propagation will be small. This is implemented in the code depth. Note that we have included well as a subfunction.

d = depth(4) d =