This preview shows pages 1–3. 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: ME 240: Introduction to Dynamics and Vibrations Mechanical Engineering Department The University of Michigan Computer Assignment #1 Supplemental Document Originally prepared by Akira Saito and modified here by Todd Lillian 1 Introduction In this document, we present how to solve a secondorder ordinary differential equation using Mat lab . Sample Matlab codes are provided for solving a simple example problem that is similar to computer assignment #1. Modifying the Matlab code in this document may be a good starting point for working on your assignment. Example Problem: The equation of motion of a simple pendulum shown in Fig. 1 can be expressed as a secondorder, nonlinear ordinary differential equation of the following form: mL + mg sin = 0 (1) where is the angle defined in Fig. 1 , denotes the second derivative of with respect to time t , m is the mass and is set to (1/9.8) kg, g is gravity and is set to 9.8 m/s 2 , and L is the length and is set to 9.8 m. Considering the following initial conditions: ( t = 0) = 4 , ( t = 0) = 0 (2) answer the following questions by solving Eq. ( 1 ) using Matlab : (a) Obtain the value of when the pendulum first hits = 0 . (b) Plot tension T as a function of . T is defined as T = mg cos + mL 2 Light, Rigid rod Figure 1: Simple Pendulum 1 2 State Equations In order to make Eq. ( 1 ) more suitable for a numerical solution, we transform this equation into a special form called state equations . In general the state equations have the following form: x = f ( x , u ) (3) where x contains all the state variables , f is a state function , and u contains inputs . If you have n state variables, Eq. ( 3 ) can be written more explicitly as, x 1 x 2 . . . x n = f 1 ( x , u ) f 2 ( x , u ) . . . f n ( x , u ) (4) Now lets transform Eq. ( 1 ) into the form of Eq. ( 4 ). We define as the first state variable, x 1 , and therefore x 1 = . The natural choice for the second state variable is , therefore x 2 = . We note that that the second time derivative of is the first time derivative of . Let us rewrite the definitions using the new notation: x 1 x 2 = (5) Now considering the time derivative of Eq. ( 5 ) and using Eq. ( 1 ), = g L sin , we get the following: x 1 x 2 = = x 2 g L sin x 1 (6) It is noted that we have two components in the state functions: f 1 ( x , u ) = f 1 ([ x 1 ; x 2 ] , ) = x 2 (7) f 2 ( x , u ) = f 2 ([ x 1 ; x 2 ] , ) = g L sin x 1 (8) The next step is to write a Matlab code to solve these equations....
View
Full
Document
This note was uploaded on 10/05/2011 for the course MECHENG 240 taught by Professor Perkins during the Fall '09 term at University of Michigan.
 Fall '09
 PERKINS
 Mechanical Engineering

Click to edit the document details