Question: Solve by matlab please!! Problem 2 : The bisection method The purpose of this exercise is to apply the bisection method and study its convergence

Solve by matlab please!!  Solve by matlab please!! Problem 2 : The bisection method The

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 end-point b and a tolerance level tol. Your function should do the following: Check that a 0. If not, should print an error message and stop execution. Return the vector midPoints that contains all midpoints generated by the bisection method applied to f with an initial interval a, b Return the vector fMidPoints that contains the corresponding function values on all midpoints generated by the bisection method applied to f, with an initial interval [a, b]. Create a figure with the graph of in a, b] AND the first and last midpoints of the bisection method 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)-0 within a tolerance of tol o the approximation to the solution of f(x)-0 caleulated by the bisection method In your prob2), call your bisectionMethod function to find the real roots of the following functions: (a) cosx -x, starting with [0,1], with tol-10-6 (b) x sin x, starting with three different intervals (one per run) and tol-10-6. Each interval should have a length of '/2 and contain a different root of x sin x AND to find (e) 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!