This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Chapter 10 Solving 1st Order ODEs using Matlab 10.1 ME 218 LAB: Ordinary Differential Equations The ability to solve differential equations is the cornerstone of using the dynamic equations of motion for analysis and design in mechanical engineering. As the systems examined become more complex (i.e. include friction, not assume point masses, etc.) it may no longer be possible to solve the derived ODEs analytically and they must be solved numerically. To illustrate a few numerical methods and their MATLAB implementation, we will solve a simple differential equation that describes the motion of a falling body including the effects of air resistance. 10.1.1 Equations Describing the Motion of a Falling Body The motion of an object that falls under the influence of gravity and air friction is governed by the following differential equation dv/dt =- ρv p + g (10.1) 100 CHAPTER 10. SOLVING 1ST ORDER ODES USING MATLAB 101 where v is the velocity (down is positive), t is time, ρ is the drag coefficient, g is acceleration due to gravity (32 feet/s), and p is a constant that can have a value between 1 and 2. For relatively slowly falling objects (a parachutist, for example), p = 1. The exact solution to Eqn. (10.1) is given by v ( t ) = C exp(- ρt ) + g/ρ ( p = 1) (10.2) where C is a constant determined from the initial conditions. In this exercise, we will assume that the falling object starts from rest so that v = 0 at t = 0. Applying this condition to Eqn. (10.2) gives 0 = C + g/ρ or C =- g/ρ . We will use the analytical solution to determine the accuracy of the proposed numerical methods. For other falling objects, a more accurate description might be given by p = 1 . 1 in Eqn. (10.1). In this case, an exact analytical solution does not exist, so we are forced to numerically solve the differential equation to describe the object’s motion. Problem 10.1 Create an m-file called falling.m. At the top of your m-file, place the CLF command (this clears the current figure window every time you run your m-file). Enter the necessary commands to create a smooth line plot of Eqn. (10.2) for t = 0 to 5 seconds with ρ = 1 . 7 and g = 32 . 2 feet/s 2 . The x-axis should have units of seconds, the y-axis should have units of feet per second, and the curve should be a smooth line. Label the x and y axes appropriately and create a title for the plot that includes your name. Put your name in the title of the plot. Turn in your figure....
View Full Document
- Fall '08
- Mechanical Engineering