Question: USE THIS CODE and finish it using these credentials: bisect.m Write a function that implements the bisection method. Its syntax is m = bisect (

USE THIS CODE and finish it using these credentials:
bisect.m
Write a function that implements the bisection method. Its syntax is
m = bisect(f,a,b,tol)
where m, f, a, b, and tol are all defined as in the notes. Use the included bisect.m as a starting point.
No credit will be given for scripts or for functions that prompt the user for input. The functions must accept arguments in the proper order as part of the function call and return outputs of the correct type. Also, do not show any intermediate calculations in the Command Window. Only the output of the function should appear.
8BISECT Find root using the bisection method
8 Function BISECT approximates the root of a function of a single
& variable f on the interval [a b] within a tolerance. The given
interval
8 must contain a sign change for f. This is because we rely on the
Intermediate Value Theorem to guarantee a solution.
Syntax:
m=bisect(f,a,b)
Input:
f- function of a single variable, in-line or anonymous
a - left endpoint of interval
b - right endpoint of interval
--Optional--
tol - error tolerance of final result, default 1e-10
Output:
m - approximate root, midpoint of final interval
& Check inputs
if a>b
temp =ai???
)
)
end
if nargin 4
tol =1e-10;
end
assert , 'The function must differ in sign at the
endpoints')
while ?abs(a-b)>2*** tol
scompute midpoint
end
 USE THIS CODE and finish it using these credentials: bisect.m Write

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!