Question: Write a MATLAB user-defined function that solves for a root of a nonlinear equation f(x) = 0 using the bisection method. Name the function Xs

Write a MATLAB user-defined function that solves for a root of a nonlinear equation f(x) = 0 using the bisection method. Name the function Xs = Bi sec t i onRoot(Fun, a, b). The output argument Xs is the solution. The input argument Fun is a name for the function that calculates f(x) for a given x (it is a dummy name for the function that is imported into BisectionRoot); a and b are two points that bracket the root. The iterations should stop when the tolerance in f(x) (Eq. (3.5)) is smaller than 0.000001. The program should check if points a and b are on opposite sides of the solution. If not, the program should stop and display an error message. Use BisectionRoot to solve Problem 3.2.

Eq. 3.5 is given below

Tolerance Inf = |(XTS)-f(xNS)| = |0] = []Determine the root of f(x) = x - 2e -x by:

(a) Using the bisection method. Start with a=0 and b=1, and carry out first three iteration.

(b) Using the secant method. Start with the two points, x 1 = 0 and x 2 = 1, and carry out the first three iteration.

(c) Using Newton's method. Start x 1 =1 and carry out the first three iteration.

Tolerance Inf = |(XTS)-f(xNS)| = |0] = []

Step by Step Solution

3.39 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets tackle the problem step by step a Bisection Method 1 Define the function fx x 2ex 2 Write the M... View full answer

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

Document Format (2 attachments)

PDF file Icon

60961f16a0c43_26626.pdf

180 KBs PDF File

Word file Icon

60961f16a0c43_26626.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!