Question: Develop a Matlab function myBisect that finds the root of a function f ( x ) within a given initial interval [ a , b

Develop a Matlab function myBisect that finds the root of a function f(x) within a given initial interval [a,b] with a tolerance in solution of at least using the bisection method.
As input the function shall take the anonymous function f, the lower and upper initial interval bounds a and b, and epsok the required tolerance in solution. As output, the function shall provide five scalar variables: the numerical solution x, its tolerance in solution tolSol, its tolerance in function tolFun, its estimated relative error ere, and the number of iterations performed n. If the initial interval [a,b] does not contain a root, the function should display an error message to that effect, set x = realmax(), and exit.
Calculate the number of required iterations by using the fact that the bisection method halves the tolerance in solution with each iteration. Use the Matlab function ceil to round to the next larger integer when calculating the number of required iterations.
Minimize as much as possible the number of function calls required per iteration, by storing function call results in temporary storage variables. You should require only 1 function call to f to update the solution per iteration.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!