{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CA1Supplement

# CA1Supplement - ME 240 Introduction to Dynamics and...

This preview shows pages 1–3. Sign up to view the full content.

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 second-order 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 second-order, 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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 let’s 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 re-write 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 ] , 0 ) = x 2 (7) f 2 ( x , u ) = f 2 ([ x 1 ; x 2 ] , 0 ) = - g L sin x 1 (8) The next step is to write a Matlab code to solve these equations.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 8

CA1Supplement - ME 240 Introduction to Dynamics and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online