Question: 6.30 (a) Develop an M-file function to implement Brent's root-location method. Base your function on Fig. 6.10, but with the beginning of the function changed

6.30 (a) Develop an M-file function to implement Brent's root-location method. Base your function on Fig. 6.10, but with the beginning of the function changed to function [b, fb] = fzeronew(f,xl, xu, varargin) % fzeronew: Brent root location zeroes % [b, fb] = fzeronew(f,xl, xu, p1, p2, ...): % uses Brent's method to find the root of f % input: % f = name of function % xl, xu = lower and upper guesses % p1,p2,... = additional parameters used by f % output: % b = real root % fb = function value at root Make the appropriate modifications so that the function per- forms as outlined in the documentation statements. In addi- tion, include error traps to ensure that the function's three required arguments (f,x1,xu) are prescribed, and that the initial guesses bracket a root. (b) Test your function by using it to solve for the root of the function from Example 5.6 using >> [x, fx] = fzeronew(@(x,n) x^n-1,0,1.3,10)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
