Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

CN 3421 Process Modeling and Numerical Simulation

Tutorial #5

1. Use Runge-Kutta 4th order method to solve the below problem. Set 0.01 as step
size. Write your own codes and compare your result with the one obtained by
using built-in function ‘ode45’.

2. Use the shooting method to solve the below problem. Develop an algorithm that
can automatically determine the next guess based on the data that have been
collected. Stop the search if
|calculated_boundary_condition – given_boundary_condition| < 10 -10.
Compare your result with the one obtained by using built-in function
‘fminsearch’.

3. Solve the below problem by using finite difference method. Use 0.01 as step size.
Compare your results with the ones obtained by using built-in function ‘bvp4c’.
Some tips are provided at the end of this document in case that you need them.

4. Solve the below algebraic equation by using bisection method. Stop the iteration
when |x - xnew| < 10-10. Compare your result with the one obtained by using
built-in function ‘fzero’.

Sin(x) – 1.5x = 5

Information for solving Question 4: What is the bisection method?


Step 1: Plot the function and locate rough position of the root you want to find. Select one
point on each side of the root (let the two points to be x1 and x2).
(Continued on the next page.)
Step 2: Let the mean value of [x1 x2] to be xnew.

Step 3: if f(x1)*f(xnew) < 0, x2 = xnew; else, x1 = new; end

Step 4: Repeat Step 2-3 until condition (|x - xnew| < 10-10) is met.
(End of introduction to bisection method. Next Page contains an idea for solving
Question 3.)
An idea for solving Question 3:

You might also like