

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


[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
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 =