Question: Matlab problem Next, implement the three basic rootfinding algorithms discussed in class as three separate functions ( bisection , Newton's, and Secant ) . Each

Matlab problem Next, implement the three basic rootfinding algorithms discussed
in class as three separate functions (bisection, Newton's, and Secant). Each rootfind-
ing function should return an array consisting of the iterates (i.e., the guesses of the
root). That is, return the array x1,x2,x3,dots,xn, where xk root. The first entry
x1 is the initial root guess, and the last entry xn is the final (and most accurate) root
guess.
We will use two checks for the stopping criteria,
(|x| tol )or(|f(xk)|lonm).
Stop your rootfinding algorithm if either of the above conditions is met. The quan-
tity x is given below for each algorithm, tol is some user specified tolerance, and
lonm is the machine epsilon (also called machine precision). Matlab has a built-in value
eps that equals machine epsilon.
(a) Bisection: Write a Matlab function that computes the root with the bisection
method. Use the midpoint of the interval (i.e., bracket) as the guess of the root.
The quantity x equals the length of the current interval (i.e., bracket).
A sample function prototype for bisection would be
function [x_arr]= my_bisection(f, c, d, tol)
where f is the function name in question (technically called a function pointer),
c,d is the initial bracket, and tol is the halting tolerance The array x_arr
is the return value, the array x1,x2,x3,dots described above.
For instance if the function for rootfinding is called my_fcn, then you would
call bisection with
x_arr_bisection = my_bisection (my_fcn, c, d, tol);
The function my_fon (x) will take in an x value and return f(x). It is this
function that you find the zero of.
(b) Newton's: Write a Matlab function that computes the root with Newton's
method. The quantity x equals x=xk-xk-1, which are your two most
recent guesses for the root.
A sample function prototype for Newton's method would be
function [x_arr]= my_newton(f, df, x_0, tol)
where f is still the function name in question (technically called a function
pointer),df is the name of a function that implements the derivative of f(tech-
nically a function pointer),x-0 is the initial guess to a root, and tol is the
halting tolerance. The return value array x_arr is the same as for bisection.
The function df(x) will take in an x value and return f'(x).
(c) Secant: Write a Matlab function that computes the root with the Secant method.
The quantity x equals x=xk-xk-1.
A sample function prototype for the Secant method would be
function [x_arr]= my_secant (f,x-0,x-1, tol
 Matlab problem Next, implement the three basic rootfinding algorithms discussed in

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!