Question: Develop a MATLAB function named bisectionMethod that finds the root of an arbitrary function of a single variable using the bisection method. Your bisectionMethod function
Develop a MATLAB function named bisectionMethod that finds the root of an arbitrary function of a
single variable using the bisection method. Your bisectionMethod function should take the following
arguments in this order: the function handle for the function to be solved, an array containing the initial
bracket initial lower and upper bounds the error tolerance, and the maximum number of iterations to
be performed. Your function should return the following values, in this order: the root, the value of the
function evaluated at the root, the estimated error, the number of iterations used. Your function should
stop iterating as soon as one of the following occurs: the error become less than the tolerance or
the number of iterations reaches the maximum. The function to be evaluated should be defined as an
anonymous function. If the function has the same sign at both ends of the initial bracket which means
the bracket may not contain a root all four return values should be zero.
Test your code with the following functions and initial brackets. Determine the roots to within
error. The testBisection test stub provides an easy way to performs these tests.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
