
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Class: COMPUTATIONAL METHODS; Subject: Mechanical Engineering; University: University of Colorado - Boulder; Term: Unknown 1989;
Typology: Study Guides, Projects, Research
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Develop, debug, and test a MATLAB program that finds a root of a nonlinear equation f ( ) x = 0
using (a) bisection method, (b) secant method, (c) Newton’s method, and (d) regularized Newton’s method. The code should be able to solve for an arbitrary function f(x). Stop your
iterations, when f ( xn ) < 10 −^6. Organize your code such a way that the code has either one or two
input parameters x 1 and x 2 (initial guess) and the sequence of guesses x =( x 1 (^) , x 2 (^) , x 3 , … , xn )as the
subplots within the same window. For both cases use semi-log scale (log scale in y direction and linear scale in x ). The figures you generate will be called convergence plot. Compare the convergence of each method, i.e. compare how fast they converge (if the method converges).
For some functions f(x) the straightforward Newton’s method could diverge. In order to make Newton’s method more robust, it is regularized the following way:
where
1 '
n n n
f x x f x
Δ (^) + = and (^1)
1
n n n n n (^) n
n x n x x
original one.
Solve the following nonlinear equations with your own program using four methods:
a)
2 1/ 2 3 2 cos 0 2 2
x x
Use the following initial guesses for both bisection and secant methods x 1 =0, x 2 =1 and x 1 =1 for both Newton’s method.
Plot the convergence plots for each case. Discuss the results. Compare the roots you obtain with
the exact values
1/ 2
x = ⎛⎜^ ⎞⎟ ⎝ ⎠
for problem (a) and
(^12) x * (^) 3 − = for problem (b).
P.S. Bring your solution to class. Email your code to [email protected]. The program that you send should be a working program. All the codes will be checked whether they run or not. If they are erroneous, but run, points will be taken for the errors. If the code does not run (it has some syntax errors), an additional 25% will be taken off. The goal of this class is for you to be comfortable solving engineering problems. Please take your time and learn how to trust the computer.