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 ie the guesses of the
root That is return the array dots, where root. The first entry
is the initial root guess, and the last entry is the final and most accurate root
guess.
We will use two checks for the stopping criteria,
tol
Stop your rootfinding algorithm if either of the above conditions is met. The quan
tity is given below for each algorithm, tol is some user specified tolerance, and
is the machine epsilon also called machine precision Matlab has a builtin 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 ie bracket as the guess of the root.
The quantity equals the length of the current interval ie bracket
A sample function prototype for bisection would be
function xarr mybisectionf c d tol
where is the function name in question technically called a function pointer
is the initial bracket, and tol is the halting tolerance The array xarr
is the return value, the array dots described above.
For instance if the function for rootfinding is called myfcn then you would
call bisection with
xarrbisection mybisection myfcn c d tol;
The function myfon x will take in an value and return 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 equals which are your two most
recent guesses for the root.
A sample function prototype for Newton's method would be
function xarr mynewton df x tol
where is still the function name in question technically called a function
pointer is the name of a function that implements the derivative of tech
nically a function pointer is the initial guess to a root, and tol is the
halting tolerance. The return value array xarr is the same as for bisection.
The function will take in an value and return
c Secant: Write a Matlab function that computes the root with the Secant method.
The quantity equals
A sample function prototype for the Secant method would be
function xarr mysecant tol
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
