Problem

(a) Develop an M-file function to implement Brent's root-location method. Base your fu...

(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 performs as outlined in the documentation statements. In addi­tion, include error traps to ensure that the function's three required arguments (f, xl, 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

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT