Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop a Matlab function that finds the root of a function f(x) within a given initial interval [a, b] with a tolerance in solution of
Develop a Matlab function that finds the root of a function f(x) within a given initial interval [a, b] with a tolerance in solution of at least e using the bisection method. Name the function myBisect using as input the anonymous function f (see page 530 of the text book on how to use anonymous functions), the lower bound a and upper bound b of the initial interval, and eps the required tolerance in solution. As output, the function should provide five scalar variables: the numerical solution, its tolerance in solution, its tolerance in function, its estimated relative error, and the number of iterations performed. If the initial interval [a, b] does not contain a root, the function should display an error message 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. You can debug your function using the first 3 iterations of problem la)
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