arizona state university cee 212 dynamics computing project 3 pendulum
Search for question
Question
Arizona State University
CEE 212 Dynamics
Computing Project 3
Pendulum
The Mechanics Project
CP 3-Pendulum
Introduction
The third computing project is called Pendulum. The concept is to model the motion of a
rod that is swinging freely but is subjected to a driven motion along an inclined plane.
The prescribed motion of the roller is given by the explicit function of time
x(t) = X sin(t)p
Where X is the (constant) amplitude of the driving motion, Q is the (constant) driving
frequency, and p is a unit vector that points in the direction of the driving motion (i.e.,
along the incline of the plane). This is the driven pendulum. We will assume that the pen-
dulum is not obstructed by the plane and can, therefore, swing in a full circle if necessary.
The equations of motion are an extension of the concepts
presented in the textbook. What we need to do for this
problem is account for the acceleration of the roller about
which the pendulum swings. The governing differential
equation comes down to a single nonlinear differential
equation in the angle 0.
x(t)
φ
L
O(t)
The pendulum was the basis for early time measurement
because for small amplitude motions the oscillations are very regular and predictable.
This project explores how a prescribed motion of the support of the pendulum influences
the motion. Among the features that can be explored are the amplitude Xo and frequency
2 of the driving motion.
The task in this computing project is to find the appropriate equations of motion includ-
ing the prescribed motion of the roller. One key new feature to this CP is that we are
computing the response of a rigid body not a particle. The time-dependent variable is
(t), which is not the position vector. The position vector for a typical particle in the rod
at distances from the roller is
x(s,t) = x(t)+sn(t)
-
Where x(t) is the driving motion given above and n(t) = sin(t) e₁ = cos(t)e, is a unit
vector that points along the rod at all times. Hence, the position vector of any particle in
the rod depends upon e(t). If we need the position vector of any point (which we will if
we want to draw the rod in motion) then we will just use the positive vector defined
above. The equation of motion for the system (derived in the PoD for Recitation 4.0) is
ΧΩ
Ö (1) -3x² sin (1)cos(0(1) - 9) + ½ ½ sin 0(1) = 0
L
1 Arizona State University
CEE 212
Dynamics
The Mechanics Project
CP 3 Pendulum
This equation comes from balance of angular momentum. Notice that it is a differential
equation for e(t). The numerical integration in the CP code will be for solving for (t).
Certainly, if we set X = 0 then we have the ordinary (undriven) pendulum problem.
However, very interesting results emerge if we subject the pendulum to the forced mo-
tion.
We can solve the problem numerically by computing the angular velocity and angle in-
crementally based upon the state at the previous time step and the equation of motion at
the current time step. To keep consistent with the notation we have been using in the
computing projects up to this point let¹ x„ =0(t), v„=ė(t) and a = Ö(t) be the angle,
angular velocity, and angular acceleration, respectively, at time t. Using the algorithm
for numerical integration we have
Va+1 =V+h[Ba +(1-B)а+]
n
Xm+1 = x„ +h[ ßv„ + (1− ß)vn+1]
n+1
where h=t+−t is the time increment and ẞ=0.5 is the trapezoidal integration pa-
rameter. The state is completely determined at t. So, if we knew а then we could
compute the new angular velocity and, knowing that, we could compute the new angle.
We get acceleration from the equations of motion
g(an+1)= a+1-
X Q²
0
L
-sin (nt) cos(x(an+1)−0) + 3—-—- sin x(a+1)
L
This function is nonlinear because X+1 depends upon a +1. The tangent matrix, which
we will need for the Newton 'while' loop, is just the scalar
dg
ΧΩ
A =
=1+
2
L
dan+1
-sin(t) sin(x(a+1) -Q) +3 -- cos x(a+1)
)+cc
L
These equations define the items needed to carry out the numerical computations for this
computing project.
What you need to do
The basic numerical algorithm for time integration is the same as the one that was im-
plemented in the previous MATLAB programs. The setup of the new program pendu-
lum.m is the same as previous codes, except that we are now seeking only to solve a
differential equation in one variable, 0, rather than a vector variable x. You will need to
establish the initial angle and initial angular velocity for the rod.
¹ The quantity x, should not be confused with the use of x as a position descriptor in the previous CPs. In the MATLAB
code we can always map the current problem onto the standard state variables x, v, and a. We do this to avoid rethinking
some of the array names used in the code. Recall that in projectile.m, x, v, a were 3 by 1 arrays and represented the vectors
associated with that single particle. In the current code we only need to keep track of a single scalar value for each of posi-
tion, velocity and acceleration.
2 Arizona State University
CEE 212-Dynamics
The specific tasks you will need to do include the following:
The Mechanics Project
CP 3 Pendulum
1. Take a look at the code projectile.m and contemplate how you can use this code
as a starting point for CP 3 (it is probably better than using your CP 2 code because
you don't need the impact pieces from CP 2). The code projectile.m has all of
the structure needed for the time-stepping algorithm, but you need to reinterpret what
the variable names represent (don't change the names, just think of them as repre-
senting the angle, angular velocity and angular acceleration).
2. Create a code that solves the driven pendulum problem by numerical integration of
the equations of motion. Use projectile.m as a starting point for developing
your code.
a. Revise the computation of the initial acceleration to reflect the equations of
motion for the current problem.
b. Modify the Newton loop to reflect the equations of motion for the current
problem. Note that for each step you will need to do a computation similar to
what you
I have done for the initial acceleration. This is an iterative process so
first you need an estimate of the current angle (xnew), which you can com-
pute from your current best estimate of the angular acceleration (anew).
C.
Add a computation of the position of the end of the bar. You can compute
this in the plotting function. You will need this to create a plot of the path of
the end of the pendulum and for the movie code.
d. Another interesting plot is the phase portrait, which simply is a plot of the
angle vs. the angular velocity. Include this plot as one of your graphical out-
put options. What happens to the phase portrait for the unforced oscillation
of the pendulum under relatively small amplitude motions?
2. Verify the code. Make sure that your code hits the published benchmark result.
Note that the benchmark is not sufficient as a code verification (see Evaluation of
Computing Projects). Look some other ways to prove that your code works in all
situations it was designed for and document them. For example, you can use the
linearized version of the unforced pendulum as one of your verification prob-
lems. The equation of motion for the pendulum with no driving motion (i.e.,
X = 0) is
Ö (t) + ¾³± sin(t) = 0
L
where g is the acceleration of gravity, and L is the length of the pendulum. The
solution to the small amplitude undriven problem is
(t) = cos at +-
@
sin @t
3 Arizona State University
CEE 212-Dynamics
The Mechanics Project
CP 3 Pendulum
where 6 is the initial angle, v. is the initial angular velocity, and @=
√3g/2L
is the natural frequency of the pendulum. Compare this result with what your
code gives. Note that this case does not verify the driven part.
3. Explore and discover. Use the code to explore the problem of pendulum motion. The
following explorations steps are required (to qualify for satisfactory rating):
a. How does the amplitude of the motion affect the natural frequency of the sys-
tem when there is no forcing function? What happens if you start the pendu-
lum in a nearly vertical position and let it swing from there? Note you can get
the actual frequency from the plot of angle vs. time by picking off the period
T (the time it takes to get from one peak in the response to the next one) and
then computing frequency as @=2π/T.
b. How does the amplitude and frequency of the prescribed displacement affect
the motion of the pendulum? What happens if you force the pendulum with a
prescribed motion that has the same frequency as the natural frequency of the
pendulum (i.e., @=2)? What if they are slightly different?
C.
Does the reaction force associated with the prescribed motion put energy into
the system or does it take it away (or both)? Calculate the reaction force in
your code and plot it!
The purpose of exploration is to use your code to learn something about the behavior
of the system you are studying. What else can you observe? What does this system
do? How to the initial conditions affect the response? Pick out what you want to ex-
plore and try to do a systematic study that involves changing the inputs and seeing
what happens. Look for trends.
4. Write a report documenting your work and the results (in accord with the specifica-
tion given in the document Guidelines for Doing Computing Projects). Post it to the
Critviz website prior to the deadline. As usual, consult the document Evaluation of
Computing Projects to see how your project will be evaluated to make sure that you
can get full marks. All projects will be subject to the peer review process.
4