Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question #3 - 6 Marks (a) Write a MATLAB function M-file with header function root = Bisect ( xl, xu, eps, imax, f) corresponding to
Question #3 - 6 Marks (a) Write a MATLAB function M-file with header function root = Bisect ( xl, xu, eps, imax, f) corresponding to the pseudocode given in Handout #8 for the Bisection method (in xl it is an "ell" not a "one"). The only differences from that given algorithm are the following: print a caption for your computed approximations by inserting the following statement just before the while statement: fprintf ( iteration approximation ') print each successive computed approximation by inserting the following statement after the computation of I, at the beginning of the while loop: fprintf ( %6.0f %18.8f ', i, xr ) print a message to indicate that the algorithm has failed to converge in imax steps by replacing the last statement in the pseudocode by the following: fprintf ( failed to converge in %g iterations ', imax) Use the function M-file Bisect to solve the following two problems (parts (b) and (c). In each case, you will need to write another MATLAB function M-file with header function y = f(x) corresponding to the function of which you are computing a zero. DELIVARABLES: A copy of your MATLAB M-file Bisect.m (b) Use Bisect to solve the following problem, you are designing a spherical tank to hold water for a small village in a developing country. The volume that it holds can be computed V=th23R-R where V is the volume in m, h is the depth of the water in the tank in meters, and R is the tank radius in meters. If R = 4.1, determine the depth h that the tank must be filled to in order that the tank holds 45 m of water. In Bisect, use an initial interval of (0.4.1), eps = 10- and imax = 20 (as was done in Handout 8). In MATLAB, 10- can be written as le-4. DELIVARABLES: MATLAB M-file for the function f, call and output of Bisect. (c) Use Bisect to solve the following problem. The velocity v of a falling parachutist of mass m kg is given by v = (1 - e-d/m) , where g = 9.81 meters per second squared. For a parachutist with drag coefficient c = 13.5 kg/s, compute the mass m so that the velocity is v = 40 meters per second at time t = 10 seconds. In Bisect, use an initial interval of 1.100), eps = 10 and imax = 20. DELIVARABLES: MATLAB M-file for the function f, call and output of Bisect
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started