Question: Problem needs to be completed using MATLAB or a similar language. Thank you! Problem 2: The bisection method The purpose of this exercise is to

Problem needs to be completed using MATLAB or a similar language. Thank you!  Problem needs to be completed using MATLAB or a similar language.

Problem 2: The bisection method The purpose of this exercise is to apply the bisection method and study its convergence. Write a function with name bisectionMethod with input a function f, a left end-point a, a right en and a tolerance level tol. Your function should do the following: . Check that a O. If not, it should print an error message and stop . Return the vector midPoints that contains all midpoints generated by the bisection method ap . Return the vector fMidPoints that contains the corresponding function values on all midpoints . Create a figure with the graph of f in [a, b] AND the first and last midpoints of the bisection with an initial interval [a, bl by the bisection method applied to f, with an initial interval a, b] marked with red marks on the x-axis. (You can use any marker style you prefer.) Print a message in the standard output, stating o the number of iterations needed to reach a solution to f(x) within a tolerance of tol. o the approximation to the solution of f(x) 0 calculated by the bisection method. In your prob20, call your bisectionMethod function to find the real roots of the following functions (a) cos x-x, starting with [0,1], with tol= 10-6 (b) xsinx, starting with three different intervals (one per run) and tol= 10-6. Each interval shoul length of /2 and contain a different root of x sin x. AND to find (c) v7 (Note: you are asked to use the bisection method to find this, do NOT use sqrt!)

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!