Question: using matlab We have covered two different root-finding methods in class: the bisection method and the Newton-Raphson method. In this homework assignment, you will explore
using matlab

We have covered two different root-finding methods in class: the bisection method and the Newton-Raphson method. In this homework assignment, you will explore the advantages and disadvantages of these methods by using them to find the first positive root of a function you know very well: f(x) = cos(x) The first positive root of this function is pi/2, or 1.5708 (Note that x is in radians). Your task is to determine how your choice of initial guesses affects the ability of the bisection method and the Newton-Raphson method to find this root. Write an m-file that uses the bisection method and the Newton-Raphson method to determine the first positive root of f(x) = cos(x) using 100 different initial guesses. For the bisection method, test 100 different initial values for the upper and lower bounds of the bracket. The widest bracket should have x_1 = 0 and x_u = 3.1, and the narrowest bracket should have x_ = 1.56 and x_u = 1.58 For the bisection method, plot the number of iterations required to find the root versus the lower bound (x_1) of the initial bracket. For the Newton-Raphson method, use 100 different initial guesses (x_0) ranging from 0 to pi. For the Newton-Raphson method, plot the number of iterations required to find the root versus the initial guess (x_0). Examine your results to determine whether each method found the correct root with each initial guess. Were there instances where the correct root was not found? Discuss the advantages and disadvantages of the bisection method and the Newton-Raphson method for finding roots
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
