Question: 01. (15 marks) Write a MATLAB function newton bisect0) that combines the Bisection and Newton's methods in a way that uses the best features of
01. (15 marks) Write a MATLAB function newton bisect0) that combines the Bisection and Newton's methods in a way that uses the best features of each. Starting with a bracketing interval [a, b,], select the first iterate a, a, then compute the next iterate z, using a Newton step. If za e [a,, b.1, proceed with either (a2%) [ai, r2] or [a2%)-t2, b.] whichever brackets Set (a, ba,,] or the root. If , [a,, b], take a Bisection step and select [a2, ba]=[r2, b.] whichever brackets the root. The function should take the following arguments . a and b, the end points of the interval where the root of fer) 0 is being sought . fname is the handle of the function that evaluates both f(s) and fCx) .tolx, a positive termination criteria nmax, maximum number of function evaluations tolx, and nmax should current interval has length smaller than tolk, or the number of times () got evaluated exceeds nmax. l be used to guarantee termination, i.e., the iterations should stop if the newton bisect) should return x, the approximate root of the equation /(z) m .fx, the value of f at a nf, the number of times (a) and f'() have been evaluated af and bf, the end points of the final bracketing interval Test your function on the equation +--x sin(z)--cos(2x) = with a 0.5 and b-3. The root is 2.380 061 273 139 339
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
