This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: LAB #8 Numerical Methods Goal : The purpose of this lab is to explain how computers numerically approximate solutions to differential equations. Required tools : Matlab routine dfield ; numerical routines eul, rk2, rk4 ; m-files. Discussion In this lab you will approximate solutions to differential equations using dfield with the various methods : Euler (Tangent Line) Method, The Improved Euler Method (Runge-Kutta-2 Method) and the Runge-Kutta-4 Method. Also you will examine what happens when the step size h is decreased for a particular problem using these methods. Assignment (1) Use dfield for 0 t 3 , y 8 to plot the direction field for the equation y = y + t (a) with initial condition y (0) = 0. Under the Options pull down menu of the Display Window, set the Solutions Direction to Forward . The idea of the tangent line method is to follow each of the little lines for short distances. Specifically, you could start from an initial position, follow one direction line for a short distance on the t axis, then pick up another line, follow it for the same distance, etc., eventually approximating a solution. The distance on the t axis is referred to as the step size and is denoted by h . If the differential equation is written y = f ( t,y ) ( b ) and our starting point is ( t ,y ), then the slope of the line through ( t ,y ) is m = f ( t ,y ) ( c ) then our endpoint is ( y 1 ,t 1 ) where t 1 = t + h and y 1 = m h + y (d) To see this for the differential equation (a), in the Options pull down menu of the Display Window, select Solver followed by Euler . A popup Settings menu should appear. Change the Step Size setting to 1 and then click on the Change Settings button TWICE. Next, ask dfield to plot the solution with the initial data y (0) = 0. (Use the Keyboard Input option of Options pull down menu of the Display Window.) You should get a piecewise linear graph made up of three lines. Since our initial point is (0 , 0), formula (c) says that the slope of the first line segment is m = 0+0 = 0. Since the step size is 1, we follow this line for 1 unit, arriving at the point ( t,y ) = (1 , 0). From formula (c), the slope of the next segment is m 1 = 0 + 1. Why is the slope of the third line segment 3 ?...
View Full Document