Presentation is loading. Please wait.

Presentation is loading. Please wait.

ME 123 Computer Applications I

Similar presentations


Presentation on theme: "ME 123 Computer Applications I"— Presentation transcript:

1 ME 123 Computer Applications I Lecture 15: More Matlab Programming: Root Finding 4/3/03

2 ME 123 Computer Applications I
Reminder Program 2 is due on Friday before class Exam 1 will be on next Monday. Lecture 15 ME 123 Computer Applications I

3 Recapitulation of Lecture 14
In the last lecture, we learned the while loop and switch statement Homework feedback: Pay attention to the ending value of your time marching variable. If the upper limit of your for loop is x_end, the Explicit Euler will give you a value at x = x_end + step_size upon completion of the loop. When you define a variable, make sure it is consistently a scalar or a vector throughout the program. Some of your programs switch between the two! Advice to your programming: Work out the problem by hand first. If you don’t know the procedure, you cannot give correct instructions to the computer! I guarantee it. You immediate task would be to understand the problem first, not the programming!! Lecture 15 ME 123 Computer Applications I

4 ME 123 Computer Applications I
Road Map of Lecture 15 Solutions to HW 4-2 More Matlab programming exercise: root finding the bisection method: cut the bounding interval in half each time until the required accuracy is achieved work out flow chart with students and emphasize its importance emphasize sequential thinking in programming Lecture 15 ME 123 Computer Applications I

5 “Crude” Flow Chart for Bisection
Input left and right bounds no Check to make sure they bound the root (How?) yes Compute the mid-point Check if the mid-point and the lower bound sandwich the root (How?) yes no upper bound = mid-point lower bound = mid-point Lecture 15 ME 123 Computer Applications I


Download ppt "ME 123 Computer Applications I"

Similar presentations


Ads by Google