Our task is to build a horn of length 1 and volume V with a Gaussian taper,
i.e., radius exp(-xt2), where t denotes intermediate
length and the taper x must be chosen to fit the desired volume.
In other words, given V one must solve
&pi &int01 exp(-2xt2)dt = V
To begin you will write a function
function val = myhorn(x,V)
val = &pi &int01 exp(-2xt2)dt - V
After writing (and testing!) myhorn embed it in a bisector
function x = taper(a,b,tol,V)
Finally write a driver that sets a=0 and b=10 and tol=0.001and computes the taper x at each V=1:.1:3 and produces a figure like that above. I recommend accumulating the V and x values and issuing one plot command at the end of the loop. For example,
for cnt = 1:20
V(cnt) = 1 + (cnt-1)/10;
x(cnt) = sin(V(cnt));
end
plot(V,x)
Your work will be graded as follows:
First Draft: 6 pts for your first attempt at stretching "flesh"
over the bisection skeleton code. Include the
myhorn function call and its call to quad
via an additional subfunction. Your draft will be
checked for organization, not syntax. Include a
primitive header and sprinkle enough comments
to indicate that you know how the flow should go.
Two M-files: horndriver.m is a script that calls taper,
taper.m is a function that calls myhorn which in
turn calls quad which in turns needs a subfunction
that evaluates the integrand. myhorn and this integrand
should both be subfunctions of taper (i.e., they should
reside at the bottom of taper.m).
18 pts for detailed headers of horndriver, taper, myhorn and
integrand featuring `usage' and `examples' and definitions
of all arguments and outputs (as in biskel.m)
10 pts for further comments in code
4 pts for indentation
14 pts for correct code.
Plot: 8 pts for jpeg plot of x versus V labeled as above but with your name.