Matlab Introduction
Matlab Introduction
in MATLAB
Brian D. Harper
Mechanical Engineering
The Ohio State University
A supplement to accompany
Engineering Mechanics: Dynamics, 6th Edition
by J.L. Meriam and L.G. Kraige
CONTENTS
Introduction
Chapter 1
5
An Introduction to MATLAB
Numerical Calculations
Writing Scripts (m-files)
Defining Functions
Graphics
Symbolic Calculations
Differentiation and Integration
7
10
12
13
21
24
Solving Equations
26
Chapter 2
37
Kinematics of Particles
38
41
46
48
52
55
Chapter 3
61
Kinetics of Particles
57
62
65
67
70
72
73
Chapter 4
77
78
80
83
Chapter 5
87
88
93
95
99
100
Chapter 6
107
Chapter 7
Introduction to Three-Dimensional
Dynamics of Rigid Bodies
108
113
115
118
120
125
129
130
132
Chapter 8
137
138
140
143
INTRODUCTION
6 INTRODUCTION
As you will see, it is not uncommon to find Mechanics problems that yield
equations that cannot be solved exactly. These problems require a numerical
approach that is greatly simplified by computational software such as MATLAB.
Although numerical solutions are extremely easy to obtain in MATLAB this is
still the method of last resort. Chapter 1 will illustrate several methods for
obtaining symbolic (exact) solutions to problems. These methods should always
be tried first. Only when these fail should you generate a numerical
approximation.
Many students encounter some difficulties the first time they try to use a
computer as an aid to solving a problem. In many cases they are expecting that
they have to do something fundamentally different. It is very important to
understand that there is no fundamental difference in the way that you would
formulate computer problems as opposed to a regular homework problem. Each
problem in this booklet has a problem formulation section prior to the solution.
As you work through the problems be sure to note that there is nothing peculiar
about the way the problems are formulated. You will see free-body and mass
acceleration diagrams, kinematic equations etc. just like you would normally
write. The main difference is that most of the problems will be parametric studies
as discussed above. In a parametric study you will have at least one and possibly
more parameters or variables that are left undefined during the formulation. For
example, you might have a general angle as opposed to a specific angle of 20.
If it helps, you can pretend that the variable is some specific number while you
are formulating a problem.
This supplement has eight chapters. The first chapter contains a brief introduction
to MATLAB. If you already have some familiarity with MATLAB you can skip
this chapter. Although the first chapter is relatively brief it does introduce all the
methods that will be used later in the book and assumes no prior knowledge of
MATLAB. Chapters 2 through 8 contain computer problems taken from chapters
2 through 8 of your textbook. Thus, if you would like to see some computer
problems involving the kinetics of particles you can look at the problems in
chapter 3 of this supplement. Each chapter will have a short introduction that
summarizes the types of problems and computational methods used. This would
be the ideal place to look if you are interested in finding examples of how to use
specific functions, operations etc.
This supplement uses the student edition of MATLAB version 7.1. MATLAB is
a registered trademark of The Mathworks, Inc., 24 Prime Park Way, Natick,
Massachusetts, 01760.
AN INTRODUCTION
TO MATLAB
INTRODUCTION TO MATLAB 9
1.7500
2.7500 3.0000
2.8510
Although range variables are very convenient and almost indispensable when
making plots, they can also lead to considerable confusion for those new to
MATLAB. To illustrate, suppose we wanted to compute a value y = 2*x-3*x^2
over a range of values of x.
EDU x=0:0.5:3;
EDU y = 2*x-3*x^2
??? Error using ==> mpower
Matrix must be square.
What went wrong? We have referred to x as a range variable because this term is
most descriptive of how we will actually use variables of this type in this manual.
As the name implies, MATLAB is a program for doing matrix calculations.
Thus, internally, x is really a row matrix and operations such as multiplication or
division are taken, by default, to be matrix operations. Thus, MATLAB takes the
operation x^2 to be matrix multiplication x*x. Since matrix multiplication of two
row matrices doesnt make sense, we get an error message. In a certain sense,
getting this error message is very fortunate since we are not actually interested in
a matrix calculation here. What we want is to calculate a certain value y for each
x in the range specified. This type of operation is referred to as term-by-term. For
term-by-term operations we need to place a period . in front of the operator.
Thus, for term by term multiplication, division, and raising to a power we would
write .*, ./ and .^ respectively. Since matrix and term-by-term addition or
subtraction are equivalent, you do not need a period before + or -. The reason that
our earlier calculations did not produce an error is that they all involved scalar
quantities. To correct the error above we write.
EDU x=0:0.5:3;
EDU y = 2*x-3*x.^2
y=
INTRODUCTION TO MATLAB 11
Now enter the program line by line into the editor. Basically, you just enter the
commands you would normally enter at a prompt (do not, however, enter >> at
the beginning of a line). If you want to enter comments, begin the line with %.
These lines will not be executed. Once you have finished entering the script into
the editor you can save the file (be sure to remember where you saved it). The
file name can contain numbers but cannot begin with a number. It also cannot
contain any mathematical operators such as +, -, *, / etc. Also, the name of the
file should not be the same as a variable it computes.
To run the script all you have to do is type the name of the program at a prompt
(>>), but without the .m extension. A common error at this point is that
MATLAB will give some response indicating that it hasnt a clue what you are
doing. The reason this happens is that the file you saved is not in the current path.
You can check (or change) the path by selecting FileSet Path from the main
menu.
Following is a simple example of a script file that sets up a range variable x and
then calculates two functions over the range.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script calculates two
% functions over a specified range
x=0:0.2:1;
f=sin(x)./(1+x)
g=sin(x).*exp(x)
%%%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%
The program was saved as example1, so here is the output you should see when
the program is entered at a prompt.
EDU example1
f=
0 0.1656 0.2782 0.3529 0.3985 0.4207
g=
0 0.2427 0.5809 1.0288 1.5965 2.2874
To save space we will, in the future, show the output of a script immediately after
the script is given without actually showing the file name being entered at a
prompt.
INTRODUCTION TO MATLAB 13
EDU load1(load1(3))
ans =
87
EDU x=1:0.2:2;
EDU g=load1(x)
g=
3.0000 2.3200 1.8800 1.6800
1.7200 2.0000
1.4 Graphics
One of the most useful things about a computational software package such as
MATLAB is the ability to easily create graphs of functions. As we will see, these
graphs allow one to gain a lot of insight into a problem by observing how a
solution changes as some parameter (the magnitude of a load, an angle, a
dimension etc.) is varied. This is so important that practically every problem in
this supplement will contain at least one plot. By the time you have finished
reading this supplement you should be very proficient at plotting in MATLAB.
This section will introduce you to the basics of plotting in MATLAB.
MATLAB has the capability of creating a number of different types of graphs.
Here we will consider only the X-Y plot. The most common and easiest way to
generate a plot of a function is to use range variables. The following example
will guide you through the basic procedure.
EDU x=-3:0.1:3;
EDU f=x.*exp(-x.^2);
EDU plot(x,f)
The procedure is very simple. First define a range variable covering the range of
the plot, then define the function to be plotted and issue the plot command. After
typing in the above you should see a graph window pop up which looks
something like the following figure.
Things like titles and axis labels can be added in one of two ways. The first is by
line commands such as those shown below.
EDU xlabel('x')
EDU ylabel('x*exp(-x^2)')
EDU title('A Simple Plot')
Take a look at the graph window after you type each of the lines above. At this
point, the graph window should look something like that shown below.
INTRODUCTION TO MATLAB 15
There are many other things that you can add or change on the plot. The easiest
way to do this is with the second of the two approaches mentioned above. In the
graph menu select ToolsEdit Plot. Now you can edit the plot in a number of
different ways. To see some of the options try either double clicking or right
clicking on the graph. You should spend some time experimenting with a graph
window to see the range of possibilities. In particular, be sure to try clicking the
show plot tools button
Once you have things like you want them you can save the graph to a file. You
can also export the graph to some format suitable for inserting in, say, a word
processor. Select FileExport Setup in the graph window to see the range of
possible formats.
What we would like to do is gain some understanding of how f varies with both x
and a. It might be tempting to make a three dimensional plot in a case like this.
Such a plot can, in some cases, be very useful. Usually, however, it is too
difficult to interpret. This is illustrated by the following three dimensional plot of
f versus x and a.
% This script produces a 3-d plot of
% f versus x and a.
x=linspace(-10,10,30);
a=linspace(-3,3,30);
[X,A]=meshgrid(x,a);
F=5+X-5*X.^2+A.*X.^3;
B=0.*A+2;
mesh(X,A,F)
colormap gray
%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%
INTRODUCTION TO MATLAB 17
The plot above certainly is interesting but, as mentioned above, not very easy to
interpret. In most cases it is much better to plot the function several times (with
different values of the parameter of interest) on a single two-dimensional graph.
We will illustrate this by plotting f as a function of x for a = -1, 0, and 1. This is
accomplished in the following script.
% script for plotting f versus x for several
% values of a.
x=-5:0.1:5;
g=5+x-5*x.^2;
f1=g-x.^3; % a = -1
f2=g;
% a = 0
f3=g+x.^3; % a = 1
plot(x,f1,x,f2,x,f3)
xlabel('x')
ylabel('f')
%%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%%%
Parametric Plots
It often happens that one needs to plot some function y versus x but y is not
known explicitly as a function of x. For example, suppose you know the x and y
coordinates of a particle as a function of time but want to plot the trajectory of
the particle, i.e. you want to plot the y coordinate of the particle versus the x
coordinate. A plot of this type is generally called a parametric plot. Parametric
plots are easy to obtain in MATLAB. You start by defining the two functions in
terms of the common parameter and then define the common parameter as a
range variable. Then issue a plot command using the two functions as arguments.
The following script illustrates this procedure.
INTRODUCTION TO MATLAB 19
% This script file illustrates parametric plotting.
% A function f is plotted versus another function g.
% The two functions are related by the
% common parameter a.
a=-1:0.05:3.5;
f=10*a.*(2-a);
g=sin(3*a);
plot(g,f)
xlabel('g')
ylabel('f')
%%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%%%%%%%%
The range selected for the parameter can have a big, and sometimes surprising
effect on the resulting graph. To illustrate, try increasing the upper limit on the
range on a a few times and see how the graph changes.
You can, of course, also plot g as a function of f.
INTRODUCTION TO MATLAB 21
EDU g1=subs(g,'x','(y-c)')
g1 =
((y-c))+a*((y-c))^2-b*((y-c))^3
EDU syms x y A B
EDU f=A*sin(x)*exp(-B*x^2)
f=
A*sin(x)*exp(-B*x^2)
EDU subs(f,B,4) % Note that B doesn't have to be in quotes since it
was declared to be a symbol.
ans =
A*sin(x)*exp(-4*x^2)
Another very convenient feature available in the Symbolic Toolbox provides the
capability of defining inline functions thus avoiding the necessity for creating
special m-files as described above. Here is an example.
EDU f=inline('x^2*exp(-x)')
f=
Inline function:
f(x) = x^2*exp(-x)
EDU f(3)
ans =
0.4481
In the previous section we plotted the function f = 5 + x 5x 2 + ax3 for several
values of a. It turns out to be somewhat more convenient to do this with an inline
function. Lets see how it works.
INTRODUCTION TO MATLAB 23
EDU f=inline('5+x-5*x^2+a*x^3')
f=
Inline function:
f(a,x) = 5+x-5*x^2+a*x^3
At this point we might anticipate a minor problem. When we plot this as a
function of x we will have a range variable as one of the arguments for f. This
creates a problem as MATLAB will be performing the numerical calculations
and it will take the operations in f as matrix operations rather than term by term.
Fortunately we can use the vectorize operator to insert periods in the
appropriate places.
EDU f=vectorize(f)
f=
Inline function:
f(a,x) = 5+x-5.*x.^2+a.*x.^3
EDU x=-5:0.1:5;
EDU plot(x,f(-1,x),x,f(0,x),x,f(1,x))
INTRODUCTION TO MATLAB 25
EDU int('sin(b*x)','x','c','d')
ans =
-(cos(b*d)-cos(b*c))/b
EDU syms x b c d
EDU f=b*log(x);
EDU int(f,x)
ans =
b*x*log(x)-b*x
EDU int(f,x,c,d)
ans =
b*d*log(d)-b*d-b*c*log(c)+b*c
If a definite integral contains no unknown parameters either in the integrand or
the integration limits, the int command will provide numerical answers. Here are
a few examples.
EDU int('x+3*x^3','x',0,3)
ans =
261/4
EDU int('log(x)','x',2,5) % Dont forget that log is the natural logarithm.
ans =
5*log(5)-3-2*log(2)
Note that Maple will always try to return an exact answer. This usually results in
answers containing fractions or functions as in the above examples. This is very
useful in some situations; however, one often wants to know the numerical
answer without having to evaluate a result such as the above with a calculator. To
obtain numerical answers use Maples eval function as in the following
examples.
EDU eval(int('x+3*x^3','x',0,3))
ans =
65.2500
EDU eval(int('log(x)','x',2,5))
ans =
3.6609
INTRODUCTION TO MATLAB 27
pi
atan(5/12)
If you want the answer as a floating point number instead of an exact result, use
the Maple command eval. For example, with g defined as above we would write
EDU eval(solve(g, 'x'))
ans =
3.1416
0.3948
Although Maple will always attempt to return an exact (symbolic) result, you
may occasionally have a case where a floating point number is returned without
using eval. Here is an example.
EDU f='10*sin(z)=2*z+1';
EDU solve(f, 'z')
ans =
.12541060097666150276238831440340
Whenever this occurs, Maple was unable to solve the equation exactly and
switched automatically to a numerical solution. In a certain sense this is very
convenient as the same command is being used for both symbolic and numerical
calculations. The problem is that nonlinear equations quite often have more than
one solution, as illustrated by the examples above. If you have the full version of
Maple then you will have various options available for finding multiple
numerical solutions. But since we are dealing now with numerical rather than
symbolic solutions it makes more sense just to use MATLAB.
The appropriate MATLAB command for the numerical solution of an equation is
fzero. This command numerically determines the point at which some defined
function has a value of zero. This means that we need to rewrite our equation in
terms of an expression whose zeros (roots) are solutions to the original
expression. This is easily accomplished by rearranging the original equation into
the form expression = 0. We will call this expression g in this example. Rewriting
the above equation f we have g = 2 z + 1 10 sin( z ) . The general format for fzero
is fzero(function_name, x0) where function_name is the name of the m-file
function that you have created and x0 is an initial guess at the root (zero) of the
function. The initial guess is very important since, if there is more than one
solution, MATLAB will find the solution closest to the initial guess. Well, you
may be wondering how we can determine an approximate solution if we do not
yet know the solution. Actually, this is very easy to do. First we define a function
g(z) whose roots will be the solution to the equation of interest. Next, we plot this
function in order to estimate the location of points where g(z) = 0. Heres how it
works for the present example.
Above is our user defined function (m-file) which we have named gz. Now we
can plot this function over some range as illustrated below.
EDU z=-1:0.01:3;
EDU plot(z,gz(z),z,0) % we also plot a line at g=0 to help find the roots.
EDU xlabel('z')
EDU ylabel('g(z)')
The plot shows that the function is zero at about z = 0 and 2. The first root is
clearly that found by Maples solve command above. Now we can easily find
both roots with the fzero command.
EDU fzero('gz', 0)
ans =
0.1254
EDU fzero('gz', 2)
ans =
2.4985
INTRODUCTION TO MATLAB 29
Here we will illustrate two methods for finding maxima and minima of a
function.
Method 1. Using the symbolic diff and solve functions.
The usual method for finding maxima or minima of a function f(x) is to first
determine the location(s) x at which maxima or minima occur by solving the
df
equation dx = 0 for x. One then substitutes the value(s) of x thus determined
into f(x) to find the maximum or minimum. Consider finding the maximum and
minimum values of the following function:
f = 1 + 2x x3
Before proceeding, it is a good idea to make a plot of the function f. This will
give us a rough idea where the minima and maxima are as a check on the results
we obtain below. The following script will plot f as a function of x.
% This script plots f as a function of x
x = -2:0.05:2;
f = 1 + 2*x - x.^3;
plot(x, f)
xlabel('x')
ylabel('f')
%%%%%%%%%% end of script %%%%%%%%%%%%%
INTRODUCTION TO MATLAB 31
EDU eval(solve(dfdx,'x'))
ans =
0.8165
-0.8165
The above results are the locations (x) where the minima and maxima occur. To
find the maximum and minimum values of the function f we use subs to
substitute these results back into f.
EDU subs(f,'x',0.8165)
ans =
2.0887
EDU subs(f,'x',-0.8165)
ans =
-0.0887
Thus, fmax = 2.0887 at x = 0.8165 and fmin = 0.0887 at x = 0.8165.
Method 2. Using MATLABs min and max functions.
EDU x = -2:0.05:2;
EDU f = 1 + 2*x - x.^3;
These two lines are identical to those in the script used to plot f above. If you
have just run that script you do not need to execute these lines. Now we can find
the minimum and maximum values of f by typing min(f) and max(f).
EDU min(f)
ans = -3
EDU max(f)
ans = 5
These are clearly not the answers we obtained above. What went wrong? It is
important to understand that min and max do not find true minima and maxima in
the mathematical sense, i.e. they do not find locations where df/dx = 0. Instead,
they find the minimum or maximum value of all those calculated in the vector f.
To see this, go back and look at the plot of f above and you will see that the
minimum and maximum values of f are indeed 3 and 5. This is another good
reason to plot the function first. To avoid the above difficulty we can change the
range of x to insure we pick up the true minima and maxima.
EDU x = -1:0.05:1;
INTRODUCTION TO MATLAB 33
EDU eqn1='x^2+y^2=12'
eqn1 =
x^2+y^2=12
EDU eqn2='x*y=4'
eqn2 =
x*y=4
In the above we have defined two equations which we will now solve for the two
unknowns, x and y.
EDU [x,y] = solve(eqn1,eqn2)
x=
5^(1/2)-1
-1-5^(1/2)
5^(1/2)+1
1-5^(1/2)
y=
5^(1/2)+1
1-5^(1/2)
5^(1/2)-1
-1-5^(1/2)
Note that four solutions have been found, the first being x = 5 1 , y = 5 + 1 .
The following example illustrates a case where there are more unknowns than
there are equations. In this case, the specified variables will be solved for in
terms of the others.
EDU f='x^2 + a*y^2 = 0'
f=
x^2 + a*y^2 = 0
EDU g='x-y = b'
g=
x-y = b
INTRODUCTION TO MATLAB 35
y=
5^(1/2)-1
-1-5^(1/2)
5^(1/2)+1
1-5^(1/2)
z=
2
2
-2
-2
KINEMATICS OF
PARTICLES
Kinematics involves the study of the motion of bodies irrespective of the forces
that may produce that motion. MATLAB can be very useful in solving particle
kinematics problems. Problem 2.1 is a rectilinear motion problem illustrating
integration with the int command. The formulation of this problem results in an
equation that cannot be solved exactly except with some rather sophisticated
mathematics. When this occurs it is generally easiest to obtain either a graphical
or numerical solution. This problem illustrates both approaches. Problem 2.2 is a
rectangular coordinates problem that illustrates diff and solve. Problem 2.3 is a
relatively straightforward problem where MATLAB is used to generate a plot
that might be useful in a parametric study. The r- components of velocity and
acceleration are plotted in problem 2.4 as well as the trajectory of a particle. In
problem 2.5, the r- components of the velocity are determined using symbolic
differentiation (diff). The problem also illustrates how computer algebra can
simplify what might normally be a rather tedious algebra problem. The diff
command is further illustrated in problems 2.6 and 2.7. Problem 2.7 is
particularly interesting in that it requires differentiation with respect to time of a
function whose explicit time dependence is unknown. This happens rather
frequently in Dynamics so it is useful to know how to accomplish this with
MATLAB.
vdv = ads = kv ds
2
v0
v
ks = ln 0
v
dv
= k ds
v
0
3. 9
k = 0.718 mi-1
(b) Here we follow the general approach in the sample problem. Integrating a =
dv/dt yields
v
dv
kt =
= k dt
v0
v v0
vv0
v=
v0
1 + ktv 0
ds = s = vdt =
0
v0
1 + ktv
0
dt
0
s=
1
ln(1 + ktv 0 )
k
KINEMATICS OF PARTICLES 39
This equation turns out to be very difficult to solve for k. A good mathematician
or someone familiar with symbolic algebra software might be able to find the
general solution for k in terms of the so-called LambertW function (LambertW(x)
is the solution of the equation yey = x). Even if this solution were found it would
be of little use in most practical situations. For example, you would have to spend
some time familiarizing yourself with the function. Once this is done you would
still have to use a program like Maple or a mathematical handbook to evaluate
the function.
For these reasons it is probably easiest to find k either graphically or numerically.
Obtaining a numerical solution with MATLAB is so easy that there is little
reason not to use this approach. It is generally advisable though to use a graphical
approach even when a numerical solution is being obtained. This is the best way
to identify whether there are multiple solutions to the problem and also serves as
a useful check on the numerical results. Thus, both approaches are illustrated
below.
The usual way to generate a graphical solution is to rearrange the equation so as
to give a function that is zero at points that are solutions to the original equation.
Rearranging the equation above in this manner yields,
f = ks ln(1 + ktv0 ) = 0
Given values of s, t, and v0, f can be plotted versus k. The value of k at which f =
0 provides the solution to the original equation.
MATLAB Worksheet and Scripts
Although the integrations are simple in this problem, we'll go ahead and evaluate
them symbolically for purposes of illustration.
EDU s_a='-1/k'*int('1/x','x','v0','v')
% part (a)
s_a = -1/k*(log(v)-log(v0))
EDU s_b=int('v0/(1+k*x*v0)','x',0,'t')
% part (b)
s_b = log(1+t*k*v0)/k
The following script implements a graphical solution for part (b). To illustrate,
we take v0 = 8 knots and assume that the boat is found to move 1.1 nautical miles
after 10 minutes.
The above graph shows that k is about 0.34 mi-1. Now let's try to find a solution
with the symbolic solve. First we write a Maple expression for f given our
assumed values for v0, s, and t.
EDU f = '1.1*k - log(1+k*8*10/60) = 0'
f = 1.1*k - log(1+k*8*10/60)=0
EDU solve(f, 'k')
ans =
0.
.33923053342470867736031513009887
Thus, k = 0.3392 mi-1.
KINEMATICS OF PARTICLES 41
Place a coordinate system at A with x positive to the right and y positive up. The
initial components of the velocity are,
(v x )0 = u cos
(v y )0 = u sin
y = usin t -1/2gt2
Plotting y in terms of x for different times t will yield the trajectory of the
projectile. This type of plot is called a parametric plot since the items plotted (x
and y) are each known in terms of another parameter (t).
Anytime you have a projectile motion problem and you know the coordinates of
a point on the trajectory (our point B) you should solve for x and y (as we have
done above) and then obtain two equations by substituting the coordinates of the
points. These two equations can then be solved for two unknowns. Note that in
most cases one of the two unknowns will be the time of flight.
Part (a) Substituting x = 5,000 m, y = 1,500 m and u = 400 m/s gives
5000 = 400cos t
however there are now three unknowns (u, , t). Suppose for the moment that the
launch angle were given and we were asked to calculate the required initial
speed u so that the projectile strikes B. In this case we would have two equations
and two unknowns. From this observation we see that u is a function of from
which we get our general solution strategy:
(a)
(b)
5000
t cos
1 2
gt . This equation is
2
now solved for t = 2(5000 tan 1500 ) / g which can be substituted back into
u to give
u=
5000
We will let MATLAB differentiate this equation and solve for the minimum
speed and the associated launch angle. The result is
umin = 256.8 m/s at = 53.3
KINEMATICS OF PARTICLES 43
and
Part (b)
EDU>> u = '5000/cos(x)/sqrt(2*(5000*tan(x)-1500)/9.81)'
u =
5000/cos(x)/sqrt(2*(5000*tan(x)-1500)/9.81)
EDU>> dudx = diff(u,'x');
EDU>> solve(dudx,'x')
ans =
.93112656063638185561346315653632
-.63966976615851476361785853510343
KINEMATICS OF PARTICLES 45
EDU>> subs(u,.9311)
ans =
256.7581
Thus,
Before plotting we need to find the time to reach point B. This can be done from
the equation x = 5000 = ucos.
EDU>> 5000/256.7581/cos(.9311)
ans =
32.6217
%=========== script #2 ======================
% this script should be run after script 1
t3 = 0:0.01:32.62;
x3 = 256.8*cos(.9311)*t3;
y3 = 256.8*sin(.9311)*t3-1/2*9.81*t3.^2;
plot(x1/1000,y1/1000,x2/1000,y2/1000,x3/1000,y3/1000)
title('plot for part (b)')
%======= end script #2 ======================
v 02
v 02
=
g cos
At the apex
At the apex, vy = 0 and v = vx = v0cos. Since v is horizontal, the
normal direction is vertically downward so that an = g.
an = g =
(v0 cos )2
(v0 cos )2
g
MATLAB Script
%%%%%%%%%%%%%%%%% Script %%%%%%%%%%%%%%%%%%%%
v0 = 100;
g = 32.2;
theta = 0:0.01:pi/2;
rho_i = v0^2/g./cos(theta);
rho_a = (v0*cos(theta)).^2/g;
plot(theta*180/pi,rho_i, theta*180/pi,rho_a)
xlabel('theta (deg)')
title('radius of curvature (ft)')
axis([0 90 0 800])
% note that we need to limit the vertical axis since the
% initial rho approaches infinity as theta approaches
% 90 degrees.
%%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%
KINEMATICS OF PARTICLES 47
Note that as approaches 90, the initial goes to infinity while at the apex
approaches zero. When = 90, the ball travels along a straight (vertical) path.
As you recall, straight paths have a radius of curvature of infinity. At the apex,
the velocity will be zero giving a radius of curvature of zero.
The first part of this problem solution will be identical to that in the Sample
Problem in your text except that everything will be left in terms of t. To
summarize,
r = 0.2 + 0.04t 2
r& = 0.08t
&r& = 0.08
= 0.2t + 0.02t 3
&& = 0.12t
Now all we have to do is substitute these expressions into the definitions for the
velocity and acceleration. As usual, there is no need to make an explicit
substitution when using the computer.
v r = r& = 0.08t
v = r&
v = v r2 + v2
a r = &r& r& 2
a = r&& + 2r&&
a = a r2 + a2
The plot for part (c) can be obtained by using the suggestion in your book. First
write
x = r cos
y = r sin
and then plot y versus x. This type of plot is called a parametric plot since y is no
known explicitly as a function of x. Instead, both x and y are known in terms of
another parameter, namely t.
KINEMATICS OF PARTICLES 49
MATLAB Scripts
%======= script #1 ============================
% this script plots the velocities for part (a)
t = 0:0.01:5;
r = 0.2+0.04*t.^2;
rd = 0.08*t;
rdd = 0.08;
theta = 0.2*t+0.02*t.^3;
thetad = 0.2+0.06*t.^2;
thetadd = 0.12*t;
vr = rd;
vtheta = r.*thetad;
v=sqrt(vr.^2+vtheta.^2);
plot(t,v,t,vr,t,vtheta)
xlabel('time (seconds)')
ylabel('velocity (m/s)')
title('part (a) velocity')
%====== end of script#1=======================
KINEMATICS OF PARTICLES 51
Place a Cartesian coordinate system at the radar with x positive to the right
and y positive up. Since the rocket is coasting in unpowered flight we can
use the equations for projectile motion.
x = x 0 + v 0 cos( )t
y = y 0 + v 0 sin ( )t
1 2
gt
2
r = x2 + y2
= tan 1 ( x / y )
v r = r&
v = r&
Substitution of x and y into the above equations and carrying out the derivatives
with respect to time gives vr and v as functions of time. The results are very
KINEMATICS OF PARTICLES 53
messy and will not be given here. Remember, though, that substitutions such as
this can be made automatically when using computer software such as
MATLAB.
MATLAB Scripts
%%%%%%%%%%%%%%%%%%%% Script # 1 %%%%%%%%%%%%%%%%%%%%%%%%%
% This script obtains symbolic results for the r and
% theta components of the velocity
syms x y t x0 y0 v0 beta g
x = x0+v0*cos(beta)*t
y = y0+v0*sin(beta)*t-1/2*g*t^2
r = sqrt(x^2+y^2)
theta = atan(x/y)
vr = diff(r,t);
vtheta = r*diff(theta,t);
% The results from these operations will be copied and
% pasted into script #2 for plotting. Before they can be
% used they have to be "vectorized", which places periods
% in front of the operators to insure term by term rather
% than matrix operations. We'll go ahead and do that here
% and then copy and paste the vectorized results.
vr = vectorize(vr)
vtheta = vectorize(vtheta)
KINEMATICS OF PARTICLES 55
( )
a =
cos d 2 &
R 2 R&& sin
R dt
a =
1 d 2&
R + R& 2 sin cos
R dt
( )
R = R0 + t , = t and = t
Differentiation and substitution will be performed in MATLAB. The results are,
a R = (R0 + t ) 2 2 cos 2 (t )
MATLAB Scripts
%%%%%%%%%%%%%%%%%%%%% Script #1 %%%%%%%%%%%%%%%%%%%%%%%%%%
% This script calculates the components of the
% acceleration symbolically
% O = Omega; P = Phi; L = Lambda
syms O P L t R0
R = R0+L*t;
theta = O*t;
phi = P*t;
% Even though there are some obvious simplifications
% in this case, we still write the most general
% expressions for the spherical components of the
% acceleration. In this way we can consider other types
% of time dependence without modifying the script.
a_R = diff(R,t,2)-R*diff(phi,t)^2-R*diff(theta,t)^2
*cos(phi)^2
a_theta = cos(phi)/R*diff(R^2*diff(theta,t),t)2*R*diff(theta,t)*diff(phi,t)*sin(phi)
a_phi = 1/R*diff(R^2*diff(phi,t),t)+R*diff(theta,t)^2
*sin(phi)*cos(phi)
%%%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%%%%%%%%%
Output of script #1
a_R =
-(R0+L*t)*P^2-(R0+L*t)*O^2*cos(P*t)^2
a_theta =
2*cos(P*t)*O*L-(2*R0+2*L*t)*O*P*sin(P*t)
a_phi =
2*P*L+(R0+L*t)*O^2*sin(P*t)*cos(P*t)
%%%%%%%%%%%%%%%%%%%%% Script #2 %%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script plots the components of the acceleration
% as functions of time
% O = Omega; P = Phi; L = Lambda
L = 0.5; O = 10*pi/180;
P = 7*pi/180; R0 = 9;
tf = pi/2/P; % time at which phi=pi/2
t=0:0.05:tf;
a_R = -(R0+L*t)*P^2-(R0+L*t).*O^2.*cos(P*t).^2;
a_theta = 2*cos(P*t)*O*L-(2*R0+2*L*t)*O*P.*sin(P*t);
a_phi = 2*P*L+(R0+L*t)*O^2.*sin(P*t).*cos(P*t);
plot(t,a_R,t,a_theta,t,a_phi)
KINEMATICS OF PARTICLES 57
xlabel('time (sec)')
title('acceleration (m/s^2)')
%%%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%%%%%%%%%
Now, L& = 0 will be used to obtain a relation between vA (= x& ) and vB (= y& ).
L& = 0 = 2 y& +
xx&
2
h +x
vB =
1
2
xv A
h2 + x2
2 1+ 2
KINEMATICS OF PARTICLES 59
-2*eta*vA+1/(h^2+x(t)^2)^(1/2)*x(t)*vA
EDU eqn = subs(eqn,x,chi*h)
eqn =
-2*eta*vA+1/(h^2+chi^2*h^2)^(1/2)*chi*h*vA
Now lets remember that eqn is just a name for dL/dt which is zero. We now
solve this equation for (eta). Also recall that solve(eqn, eta) actually solves the
equation eqn = 0 for eta.
EDU eta = solve(eqn, eta)
eta =
1/2*chi*h/(h^2+chi^2*h^2)^(1/2)
We note finally that the h cancels in the above expression yielding the result
given in the problem formulation section above. Now we can produce the
required plot.
%%%%%%% Script for plotting chi versus eta %%%%%
chi = 0:0.01:2;
eta = 1/2*chi./sqrt(1+chi.^2);
plot(chi,eta)
xlabel('x/h')
title('v_B/v_A')
%%%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%%
KINETICS OF
PARTICLES
(1)
[F
= ma y = 0
[Fx = ma x ]
N 400 cos(30) = 0
k N 2T + 400 sin(30) =
400
aC
32.2
Substituting N yields,
400 k cos(30) 2T + 400 sin(30) =
400
aC
32.2
(2)
[ F = ma]
250 T =
250
aA
32.2
(3)
MATLAB will be used to solve the three equations above for aA, aC and T in
terms of k. Since the accelerations are constant, v 2A = 2a A d where d is the
vertical distance through which block A has fallen. Thus, the velocity of A when
it strikes the ground (d = 20 ft) is
KINETICS OF PARTICLES 63
v Af = 40a A = v B
MATLAB Scripts
%%%%%%%%%%%%%%%%% Script #1 %%%%%%%%%%%%%%%%%%%%%%%%%
% This script solves the three equations developed
% in the problem formulation section for the two
% accelerations (aC and aA) and the tension T.
% When solving multiple equations, it is a good idea
% to let the variables solved for be single characters.
% Thus, we set x = aC, y = aA, z = T.
eqn1 = '2*x+y = 0';
eqn2 = '400*muk*cos(theta)-2*z+400*sin(theta)=400/32.2*x';
eqn3 = '250-z = 250/32.2*y';
[x,y,z]=solve(eqn1,eqn2,eqn3)
%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%%%%%%
a A = 13.8 15.9349 k
Note that the accelerations may be either positive or negative depending on the
value of k . The largest value of k for which the block will move up can thus
be found by solving the equation aA = 0 for k . This yields k = 13.8/15.935 =
0.866.
%%%%%%%%%%%%%%%%%%% Script #2 %%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script plots the vB (the velocity of the
% block as it hits the ground) versus the friction
% coeficient mu_k
muk = 0:0.01:1;
aA=-15.9349*muk+13.8;
vB = sqrt(40*aA)
plot(muk,vB)
xlabel('mu_k')
ylabel('v_B (ft/sec)')
%%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%%%%%%%%%
At first sight, it seems that no results are plotted beyond the limiting value for k
(0.866) that was determined above. If the plot were in color, you would see that
MATLAB has actually plotted zeros beyond this point. From a numerical point
of view this occurs because MATLAB will plot only the real part of complex
numbers. If you have MATLAB print the values of vB you will find that the real
parts of all the complex numbers generated are zero. Whenever imaginary or
complex values result there is usually some physical explanation. In this
problem, the physical explanation is that the log will not slide up the incline if the
coefficient of friction is too large.
KINETICS OF PARTICLES 65
Fr = 0 = ma r = m r&& r& 2
&r& = r& 2 = r 02
r = A sinh( 0 t ) + B cosh( 0 t )
The constants A and B are found from the initial conditions. These conditions are
that r = r0 and r& = 0 at t = 0. The second condition comes from the fact that the
particle has no velocity (initially) relative to the tube. Before evaluating this
condition we must first differentiate r with respect to time.
r = r0 cosh( 0 t )
From this we can obtain the radial and transverse velocities,
v = r& = r0 0 cosh( 0 t )
The absolute path of the particle will be graphed using polar plotting. For this we
need r as a function of . Since = 0t we have,
r = r0 cosh( )
We want to plot this function only up to the point where the particle leaves the
tube. Substituting r = 1 we have 1 = 0.1cosh(), or = cosh-1(10) = 2.993 rads.
Thus, the particle leaves the tube when = 2.993 rads (171.5).
MATLAB Worksheet
KINETICS OF PARTICLES 67
1
1
2
k x22 x12 = k (1.2 + ) 2
2
2
1
1
m v 2 v 02 = (10)v 2
2
2
V g = mgh = 10(9.81)(1.2 sin 30) = 58.9 J
U 1 2 = 250(0.6) = 150 J
U 1 2 = 150 =
T =
1
(10)v 2 + 58.9 + 1 (60 ) (1.2 + )2 2
2
2
This equation can be solved for v either by hand or by using MATLAB. The
result is
v=
1
958 1440
10
KINETICS OF PARTICLES 69
At first sight, it seems that no results are plotted beyond 0.65 m. If the plot
were in color, you would see that MATLAB has actually plotted zeros beyond
this point. Why? One reason is to observe from the above equation that v
becomes imaginary when > 958/1440 = 0.665 m. MATLAB interprets
imaginary numbers as complex numbers with a real part equal to zero. When
asked to plot a complex number it will plot only the real part. Thus, we have
zeros plotted after = 0.665 m. But this is a numerical reason instead of a
physical explanation. Usually, imaginary answers signify a situation that is
physically impossible for some reason. One way of understanding this is as
follows. If the spring is initially compressed it will, at least for some part of the
motion, be pushing up and thus be aiding the 250 N force in overcoming the
weight of the slider. If the spring is initially stretched, it will always be pulling
back on the slider. Thus the 250 N force will have to overcome not only the
weight but also the spring force. It stands to reason then that there will be some
value for the initial spring stretch beyond which the 250 N force will not be able
to pull the slider all the way to C. This value is found from the limiting case
where v = 0. Thus, the block never reaches C if > 0.665 m.
(1) Impulse/Momentum
During impact, G = 0 and G1 = G 2
2 / 16 50
2 / 16 + 50
v +
( 0) =
v b
32.2 32.2
32.2
v = 401v b
where v is the velocity of the projectile while vb is the velocity of the box of sand
immediately after impact.
(2) Work/Energy
Now we use the work/energy equation with our initial
position being the position where the pendulum is still
vertical ( = 0) and the final position is that where the
pendulum has rotated through the maximum angle .
U 1 2 = 0 = T + V g =
1
m 0 2 v b2 + mgh
2
KINETICS OF PARTICLES 71
MATLAB Worksheet
where
r02
r2
0
and
MATLAB Script
%%%%%%%%%%% script %%%%%%%%%%%%%%%
theta = 0:0.05:pi/2;
r0 = 0.1+0.6*cos(pi/4);
r = 0.1+0.6*cos(theta/2);
w0 = 40*2*pi/60;
w = r0^2./r.^2*w0;
plot(theta*180/pi, w)
xlabel('theta (degrees)')
ylabel('omega (rad/s)')
%%%%%%%% end of script %%%%%%%%%%%
KINETICS OF PARTICLES 73
[Fn = man ]
N mg cos = mr 2
[Ft = mat ]
F mg sin = 0
s =
g sin
sin
=
2
1
.
8925
+ cos
g cos + r
The last two questions can be answered only after plotting s as a function of .
MATLAB Worksheet and Scripts
%%%%%%%%%%%%%%%% Script #1 %%%%%%%%%%%%%%%%%%%%
% This script solves our two equations symbolically
% for mu_s and N
% O = Omega
% x = mu_s
% y = N
syms theta O g m r x y
eqn1 = y-m*g*cos(theta)-m*r*O^2;
eqn2 = x*y-m*g*sin(theta);
% remember that we write our equations in the form
% expression = 0 and then omit the "=0"
[x,y] = solve(eqn1,eqn2)
%%%%%%%%%%%%%%end of script %%%%%%%%%%%%%%%%%%%%
Output of script #1
x=
g*sin(theta)/(g*cos(theta)+r*O^2)
y=
m*g*cos(theta)+m*r*O^2
%%%%%%%%%%%%%%%% Script #2 %%%%%%%%%%%%%%%%%%%%
% This script plots mu_s as a function of theta
theta = 0:0.02:pi;
mu_s = sin(theta)./(1.8925+cos(theta));
plot(theta*180/pi, mu_s)
xlabel('theta (degrees)')
title('coefficient of static friction')
%%%%%%%%%%%%%%end of script %%%%%%%%%%%%%%%%%%%%
KINETICS OF PARTICLES 75
If the block is not to slip at any angle , the coefficient of friction must be greater
than or equal to any value shown on the plot above. Thus, the minimum required
coefficient value min that would allow the block to remain fixed relative to the
drum throughout a full revolution is equal to the maximum value in the plot
above. The location where this maximum occurs can be found by solving the
equation d s / d = 0 for . This can then be substituted into s to yield the
required value for min. Heres how we do this with MATLAB.
EDU syms theta
EDU mu_s = sin(theta)./(1.8925+cos(theta));
EDU dmu = diff(mu_s,theta)
dmu = cos(theta)/(757/400+cos(theta))+sin(theta)^2/(757/400+cos(theta))^2
EDU theta_m = solve(dmu,theta)
theta_m =
-atan(1/302800*236697316401^(1/2))+pi
atan(1/302800*236697316401^(1/2))-pi
EDU eval(theta_m)
ans =
2.1275
-2.1275
EDU mu_min = subs(mu_s,theta,2.1275)
mu_min = 0.6224
From the above we see that min = 0.622. If s is slightly less than this value, the
block will slip when = 2.128 rads (121.9).
KINETICS OF SYSTEMS
OF PARTICLES
This chapter concerns the extension of principles covered in chapters two and
three to the study of the motion of general systems of particles. The chapter first
considers the three approaches introduced in chapter 3 (direct application of
Newtons second law, work/energy, and impulse/momentum) and then moves to
other applications such as steady mass flow and variable mass. Problem 4.1
considers an application of the conservation of momentum to a system comprised
of a small car and an attached rotating sphere. MATLAB is used to plot the
velocity of the car as a function of the angular position of the sphere. The
absolute position of the sphere is also plotted. Problem 4.2 uses the concept of
steady mass flow to study the effects of geometry upon the design of a sprinkler
system. One of the main purposes of this problem is to illustrate how a problem
can be greatly simplified using non-dimensional analysis. In particular, an
equation containing seven parameters is reduced to a non-dimensional equation
with only three parameters. Problem 4.3 is a variable mass problem in which
MATLAB is used to integrate the kinematic equation vdv = adx .
(G x ) =0 = 20(0.6) + 5(0.6) = 15
(G x )
Ns
Now let time t = 0 be the time when = 0 and place an x-y coordinate system at
the center of the car as shown in the diagram so that x(t) is the position of the
center of the car. Since v = dx/dt and = 4t we have,
t
x = vdt =
0
M 0 = M = Q r 2 + b 2 ur 0
M = Q ur r 2 + b 2
))
M =1 1+ 2
1
1+ 2
MATLAB Scripts
%%%%%%%%%%%%%%%% Script #1 %%%%%%%%%%%%%%%%%
% This script plots the non-dimensional torque
% M' as a function of beta = b/r for Omega =
% 0.5, 1, and 2
beta = 0:0.01:1;
Mp = inline('1-Omega*(1+beta.^2)')
plot(beta, Mp(0.5,beta),beta, Mp(1,beta),beta, Mp(2,beta))
xlabel('beta = b/r')
title('non-dimensional torque')
%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%
[Fx = ma x ]
T = (L h x )&x&
F y = ma y
gh T = h&x&
Substituting T from the first equation into the second and simplifying gives,
&x& =
gh
Lx
v1
vdv =
gh
dx
Lx
v1 = 2 gh ln (L / h )
L h
v12 = 2
gh
L
dx = 2 gh ln
Lx
h
1 2
v 2 v12 = gh
2
EDU syms v v1 v2 h g x L
L h
v1
vdv
the =0.
EDU eqn1 = int(v,v,0,v1)-int(g*h/(L-x),x,0,L-h)
eqn1 =
1/2*v1^2+log(h)*g*h-log(L)*g*h
EDU solve(eqn1,v1)
ans =
(-2*log(h)*g*h+2*log(L)*g*h)^(1/2)
-(-2*log(h)*g*h+2*log(L)*g*h)^(1/2)
MATLAB has found two solutions. The first is the one we want since it is
positive. This solution can easily be simplified to the result given above in the
problem formulation section. Once v1 is known it is rather easy to find v2. Well
do it symbolically here for purposes of illustration.
First we copy and paste the first solution above to define v1. Then we solve the
equation
v2
v1
vdv gdy = 0 for v2. Note how the result for v1 is automatically
0
substituted.
EDU v1 = (-2*log(h)*g*h+2*log(L)*g*h)^(1/2);
EDU eqn2 = int(v,v,v1,v2)-int(g,x,0,h)
eqn2 =
1/2*v2^2+log(h)*g*h-log(L)*g*h-g*h
EDU solve(eqn2,v2)
ans =
(-2*log(h)*g*h+2*log(L)*g*h+2*g*h)^(1/2)
-(-2*log(h)*g*h+2*log(L)*g*h+2*g*h)^(1/2)
Once again, the first solution will simplify to that given in the problem
formulation section above.
%%%%%%%%%%%%%%%%%%% Script %%%%%%%%%%%%%%%%%%%%
% This script plots v1 and v2 as functions of
% h for L = 5 m
L = 5; g = 9.81;
h = 0:0.01:L;
v1 = sqrt(2*g*h.*log(L./h));
v2 = sqrt(2*g*h.*(1+log(L./h)));
plot(h, v1, h, v2)
xlabel('h (m)')
ylabel('velocity (m/s)')
%%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%%
PLANE KINEMATICS OF
RIGID BODIES
dt
= dt = 12 3u 2 du = 12t t 3
N=
1
1
12t t 3
dt = 12 3t 2 dt =
2 0
2
N=
1 2
1 t
1 2
2
dt
dt
12
3
t
dt
12 3t 2 dt
2 0
2 2
2 0
2
N=
1
32 12t + t 3
2
In summary,
= 12t t 3
(
(
all t
1
3
2 12t t
N =
1
32 12t + t 3
2
t < 2 sec
t > 2 sec
Although the expression for N is rather simple, plotting the result can be a little
tricky due to the change in the expression at time t = 2 sec. How do we tell
MATLAB to stop plotting one expression and start plotting the other?
Actually, this is considerably easier to do in MATLAB than in some other
applications (e.g. Maple) due to the fact that you are not limited to a single range
variable for the ordinate. Thus we can easily set up two time variables t1 and t2
and then write the two expressions in terms of those two variables.
MATLAB Scripts
%==== script #1 ==========================
% This script plots the angular velocity as
% a function of time. Note the way a horizontal
% line at zero is plotted. This is useful for
% visualizing where omega becomes negative
t = 0:0.05:4;
omega = 12 - 3*t.^2;
zero = 0*t;
plot(t,omega,t,zero)
xlabel('time (sec)')
title('angular velocity (rad/s)')
%======= end of script ===================
y = 2b sin
y& = 2b& cos
s 2 = L2 + b 2 2 Lb cos
2ss& = 0 + 0 + 2 Lb& sin
ss&
Lb sin
& =
Substituting,
v=
2bss&
2s& L2 + b 2 2 Lb cos
cos =
Lb sin
L tan
2 1 + (b / L ) 2(b / L ) cos
2
v / s& =
where = b/L.
tan
2 1 + 2 2 cos
tan
Let l be the length of connecting rod AB. Start with the relative velocity equation
vB = vA + vB/A
r2
r
sin Also, cos = 1 sin 2 = 1 2 sin 2
l
l
cos
r
cos
r cos
v A = r (sin + cos tan ) = r sin 1 +
r2
l
1
sin 2
2
l
Note that vA has been expressed explicitly in terms of by substituting for cos
and tan. This has been done only for sake of clarity. When working with a
Output of script #1
vA =
r*omega*sin(theta)+cos(theta)/(1-r^2/L^2*sin(theta)^2)^(1/2)*
r^2*omega/L*sin(theta)
%%%%%%%%%%%%%%%%%%% Script #2 %%%%%%%%%%%%%%%%%%%
% This script plots the velocity of piston A
% as a function of theta
r = 5/12;
L = 14/12;
o = 1500*2*pi/60; % o=omega
x = 0:0.01:2*pi;
% x=theta
vA = r*o*sin(x)+cos(x)./(1-r^2/L^2*sin(x).^2).^(1/2)*r^2*o/L.*sin(x);
plot(x*180/pi,vA)
xlabel('theta (degrees)')
title('velocity of piston A (ft/sec)')
%%%%%%%%%%%%% end of script %%%%%%%%%%%
Part (b)
%%%%%%%%%%%%%%%%%%% Script #3 %%%%%%%%%%%%%%
% This script solves for the values of theta which
% make vA a maximum
r = 5/12;
L = 14/12;
omega = 1500*2*pi/60;
syms theta
% The following is copied and pasted from the output of
% script #1
vA = r*omega*sin(theta)+cos(theta)/(1r^2/L^2*sin(theta)^2)^(1/2)*r^2*omega/L*sin(theta)
dvAdtheta = diff(vA,theta)
solve(dvAdtheta,theta)
%%%%%%%%%%%%%%%%%% end of script %%%%%%%%%%%
Output of script #3
vA =
125/6*pi*sin(theta)+625/84*cos(theta)/(1-25/196*sin(theta)^2)^(1/2)*
pi*sin(theta)
dvAdtheta =
125/6*pi*cos(theta)-625/84*sin(theta)^2/(1-25/196*sin(theta)^2)^(1/2)*pi+
15625/16464*cos(theta)^2/(1-25/196*sin(theta)^2)^(3/2)*pi*sin(theta)^2+
625/84*cos(theta)^2/(1-25/196*sin(theta)^2)^(1/2)*pi
r
r
r
r
a A = aO + (a A / O )n + (a A / O )t
The acceleration of O is to the right while the normal
relative acceleration must point from A towards O. Since
is constant, the tangential relative acceleration will be
zero. These considerations lead to the vector diagram
shown to the right. Using the law of cosines,
( )
a A = aO2 + r 2
( )
2aO r 2 cos
MATLAB Script
%======== script ==============================
aA = inline('sqrt(3^2+0.8^2*omega^4-2*3*0.8*omega^2*cos(theta))')
th = 0:.05:2*pi;
plot(th,aA(2,th),th,aA(4,th),th,aA(6,th))
xlabel('theta (radians)')
ylabel('acceleration (m/s^2)')
%========= end of script =======================
This problem appears in sample problems 5/9 and 5/15 in your text. Sample
problem 5/9 considers a relative velocity analysis while sample problem 5/15
uses a relative acceleration analysis. Generally speaking, the easiest approach to
use with a computer is an absolute motion analysis, provided you have software
capable of doing symbolic algebra and calculus such as MATLAB. We will use
the present problem to illustrate this approach.
= sin 1 sin
l
where l is the length of connecting rod AB and is the angle between AB and the
horizontal. Now place an x-y coordinate system at O with x positive to the right
and y positive up and write expressions for the coordinates of A and G in terms of
and
x A = r cos l cos
x G = r cos r cos
y G = (l r ) sin
where r is the distance from B to G (4 in. in the figure). All that is needed to find
the velocities vA, vGx, and vGy is to differentiate these expressions with respect to
time. The magnitude of the velocity of G is then found from
2
v G = v Gx + vGy
The accelerations aA, aGx, and aGy are then found by differentiating vA, vGx, and
vGy with the magnitude of the acceleration of G being obtained from,
2
aG = aGx + a Gy
Since we will be differentiating with respect to time, the first thing we will do in
the computer program is to define as a function of time. Then, when we write
the above expressions for , xA, xG, and yG, the computer will automatically
substitute for rendering each of these as functions of time. Assuming that is
initially zero,
(t ) = t =
1500(2 )
t = 157.1t
60
The problem statement asks us to plot versus time for two revolutions ( = 4
radians) of the crank. The time required for two revolutions is 4/157.1 = 0.08
sec.
Output of Script #1
xA = -r*cos(w*t)-L*(1-r^2/L^2*sin(w*t)^2)^(1/2)
xG = -r*cos(w*t)-rb*(1-r^2/L^2*sin(w*t)^2)^(1/2)
yG = (L-rb)*r/L*sin(w*t)
vA =
r*sin(w*t)*w+1/L/(1-r^2/L^2*sin(w*t)^2)^(1/2)*r^2*sin(w*t)*cos(w*t)*w
vG =
((r*sin(w*t)*w+rb/(1-r^2/L^2*sin(w*t)^2)^(1/2)*r^2/L^2*
sin(w*t)*cos(w*t)*w)^2+(L-rb)^2*r^2/L^2*cos(w*t)^2*w^2)^(1/2)
aA =
r*cos(w*t)*w^2+1/L^3/(1-r^2/L^2*sin(w*t)^2)^(3/2)*r^4*sin(w*t)^2*
cos(w*t)^2*w^2+1/L/(1-r^2/L^2*sin(w*t)^2)^(1/2)*r^2*cos(w*t)^2*w^21/L/(1-r^2/L^2*sin(w*t)^2)^(1/2)*r^2*sin(w*t)^2*w^2
aG =
((r*cos(w*t)*w^2+rb/(1-r^2/L^2*sin(w*t)^2)^(3/2)*r^4/L^4*sin(w*t)^2*
cos(w*t)^2*w^2+rb/(1-r^2/L^2*sin(w*t)^2)^(1/2)*r^2/L^2*cos(w*t)^2*w^2-
rb/(1-r^2/L^2*sin(w*t)^2)^(1/2)*r^2/L^2*sin(w*t)^2*w^2)^2+(L-rb)^2*
r^2/L^2*sin(w*t)^2*w^4)^(1/2)
The results for the velocities and accelerations will be used to produce the
required plots in the following two scripts. The easiest thing to do is to copy the
results from the worksheet into the scripts. Before doing this you should use the
vectorize command to place periods at appropriate places in order to insure term
by term rather than matrix operations. After running the script type
vectorize(vA) in the worksheet and then copy and paste the result into the
script. Repeat this process for vG, aA, and aG.
%%%%%%%%%%%%%% Script #2 %%%%%%%%%%%%%%%%%%
% This script plots vA and vG versus time
r = 5/12;
rb = 4/12; % r_bar
L = 14/12;
w = 1500*2*pi/60; % w=omega
t = 0:0.001:0.08;
vA = r.*sin(w.*t).*w+1./L./(1-r.^2./L.^2.*sin(w.*t).^2).^
(1./2).*r.^2.*sin(w.*t).*cos(w.*t).*w;
vG = ((r.*sin(w.*t).*w+rb./(1-r.^2./L.^2.*sin(w.*t).^2).^
(1./2).*r.^2./L.^2.*sin(w.*t).*cos(w.*t).*w).^2+(Lrb).^2.*r.^2./L.^2.*cos(w.*t).^2.*w.^2).^(1./2);
plot(t, vA, t, vG)
%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%
Suppose you wanted to solve this problem for the case where crank OB has a
constant angular acceleration = 60 rad/s2. It turns out that you can solve this
problem using exactly the same approach as above, changing only one line
defining the dependence of upon time. Assuming that the system starts from
rest at = 0, the appropriate expression for is (t) = t2 = 30t2. The
accelerations for this case are shown below in case you want to give it a try.
PLANE KINETICS OF
RIGID BODIES
This chapter concerns the motion (translation and rotation) of rigid bodies that
results from the action of unbalanced external forces and moments. In problem
6.1, five equations are solved for five unknowns. The problem illustrates an
alternative to the blunt (but straightforward) simultaneous solution of multiple
equations. Instead, the equations are solved in such a way that there is never
more than one unknown. In this way, the results are immediately obtained via
automatic substitution, thus avoiding some tedious algebra. The force at the
hinge of a pendulum is plotted versus the angular position of the pendulum in
problem 6.2. The algebra is rather simple in this case and MATLAB is used
primarily for purposes of plotting. Problems 6.3 and 6.4 consider rigid bodies in
general plane motion. solve is used in problem 6.3 to solve two equations
simultaneously for two unknowns. The maximum acceleration of a point on the
rigid body is then obtained by using diff and solve. In this problem, solve finds
five solutions to the equation and it is necessary to determine which of these is
physically correct. This problem is also interesting since a very natural guess
of the value for the maximum acceleration turns out to be incorrect. Problem 6.4
is an example of a kinetics problem that also requires some kinematics. The
angular acceleration of a bar is determined by summing moments. The kinematic
equation d = d is then integrated to obtain the angular velocity. Problem
6.5 is an interesting work and energy problem that is complicated considerably
by the fact that a spring is engaged for only part of the motion of a rotating bar.
Symbolic algebra simplifies this problem considerably, though it is still rather
tedious. It is common in Dynamics to find problems that require a combination of
methods for their solution. Problem 6.6 is a good example involving both
conservation of momentum and work/energy.
[M C
= 0]
M r At = 0
(1)
As pointed out in the sample problem, the force and moment equations are
identical to the equilibrium equations whenever the mass is negligible.
From the free-body diagram of the vertical bar,
[M A = ma d ]
[Ft
= mat ]
[Fn = ma n ]
(2)
At mg cos = mr
(3)
B An + mg sin = mr 2
(4)
d = d
(5)
At this point we have a total of 5 equations and 6 unknowns (M, , , At, An, and
B). In part (a), M is specified while in part (b) is given. In both cases we will
have 5 equations and 5 unknowns; however, it will be necessary to solve no more
than one equation at a time provided they are done in the right order. This is what
yields a different procedure for parts (a) and (b).
Part (a)
With M known we can find At from Equation (1) and then substitute the result
into Equation (3) to get as a function of .
At =
M
r
At g
cos
mr r
1 2
g
A
= t cos d
2
mr r
g
At
sin
r
mr
2 = 2
Finally, we can substitute into Equations (2) and (4) to find B and then An.
B=
mr rAG
2 cos + sin
rAB cos
An = B + mg sin mr 2
A=
An2 + At2
Part (b)
= 2 d = 2 d = 2
2
At = mg cos + mr
Now we can substitute into Equations (1), (2) and (4) to find M, B and then An.
M = r At
B=
mr rAG
2 cos + sin
rAB cos
An = B + mg sin mr 2
A=
An2 + At2
MATLAB Scripts
%========= script for part a ===========
m = 0.15; g = 9.81; r = 1.5;
rAB = 1.8;
rAG = 1.2;
rAC = r;
M = 5;
theta = 0:0.1:60;
thr = theta*pi/180;
At = M/r;
alpha = At/m/r - g/r*cos(thr);
omsq = 2*(At*thr/m/r - g/r*sin(thr));
B = m*r*rAG*(omsq.*cos(thr)+alpha.*sin(thr))/rAB./cos(thr);
An = B + m*g*sin(thr)-m*r*omsq;
A = sqrt(At.^2 + An.^2);
plot(theta,B,theta,A)
xlabel('theta (degrees)')
ylabel('force (kN)')
title('part (a): constant M')
======= end of script=====================
[M O = I O ]
mgr cos = mk 02
[d = d ]
d =
2 =
[F
= mr 2
[Ft = mr ]
2 gr
k 02
gr
k 02
gr
k 02
gr
2
0
cos d = k
cos
sin
sin
O n mg sin = mr 2
Ot + mg cos = mr
r2
O n = mg 1 + 2 2
k0
sin
O=
(On ) 2 + (Ot )2
r2
Ot = mg 1 2
k
0
cos
where (aG/A)n =
[M
l 2
l
=0, (aG/A)t = .
2
2
= I + ma d
[Fx = ma x ]
0=
l l
l
1
ml 2 + m ma A cos
12
2 2
2
mg sin = m a A cos
2
6( g / l ) sin cos
4 3 cos 2
aA =
4 g sin
4 3 cos 2
At first, the answer to part (b) seems obvious. Intuitively, we would like to say
that the maximum acceleration is aA = g and occurs at = 90. But this intuition
neglects the effects of the bars rotation upon the acceleration. As we will see
below, the maximum acceleration is somewhat larger than g.
The maximum acceleration is obtained in the usual manner. The orientation
where the maximum occurs is first found by solving the equation da A / d = 0
When using the solve command to solve simultaneous equations, be sure that the
variables solved for are single characters. Thus, in the following we let x = aA
and y = . Also remember that the equations solved must be in the form where
the right hand side is zero. The equals sign is omitted.
EDU syms x y L theta g m
EDU eqn1 = 1/12*m*L^2*y+m*L/2*y*L/2-m*x*L/2*cos(theta)
eqn1 = 1/3*m*L^2*y-1/2*m*x*L*cos(theta)
EDU eqn2 = m*g*sin(theta)-m*(x-L/2*y*cos(theta))
eqn2 = m*g*sin(theta)-m*(x-1/2*L*y*cos(theta))
EDU [x,y]=solve(eqn1,eqn2)
x = -4*g*sin(theta)/(-4+3*cos(theta)^2)
y = -6*cos(theta)*g*sin(theta)/L/(-4+3*cos(theta)^2)
The result for x will be used in the script below to plot aA versus . It is
convenient to go ahead and do part (b) first as we have everything already set up.
EDU aA = subs(x,g,9.81)
aA = -981/25*sin(theta)/(-4+3*cos(theta)^2)
EDU daA = diff(aA,theta)
daA =
-981/25*cos(theta)/(-4+3*cos(theta)^2)-5886/25*sin(theta)^2/
(-4+3*cos(theta)^2)^2*cos(theta)
EDU solve(daA,theta)
ans =
1/2*pi]
atan(1/6*3^(1/2)*6^(1/2))
-atan(1/6*3^(1/2)*6^(1/2))
-atan(1/6*3^(1/2)*6^(1/2))+pi
atan(1/6*3^(1/2)*6^(1/2))-pi
MATLAB has found five solutions. Now we use the eval command to put these
in a form easier to understand.
EDU eval(ans)
ans =
1.5708
0.6155
-0.6155
2.5261
-2.5261
Only two of the five solutions are in the range from 0 to 90. These two solutions
are /2 (90) and 0.6155 rad (35.3). Substitution will reveal which is the
maximum. Of course, we could also look at the plot below to see that the second
solution corresponds to a maximum.
EDU subs(aA,theta,.6155)
ans = 11.3276
EDU subs(aA,theta,pi/2)
ans = 9.8100 % this result shouldnt be surprising
Thus, (aA)max = 11.33 m/s2 when = 35.3.
%%%%%%%%%%%%%%%%%% Script %%%%%%%%%%%%%%%%%
% This script plots aA versus theta
g = 9.81;
theta = 0:0.01:pi/2;
aA = -4*g*sin(theta)./(-4+3*cos(theta).^2);
plot(theta*180/pi, aA)
xlabel('theta (deg)')
ylabel('a_A (m/s^2)')
%%%%%%%%%%%%%%%% end of script %%%%%%%%%%%%
[M
= I + ma d
mg
L
L L
L
1
sin = mL2 + m ma cos
12
2 2
2
2
3
(g sin + a cos )
2L
3
(g (1 cos ) + a sin )
L
MATLAB Script
%%%%%%%%%%%%%%%%%%%% Script %%%%%%%%%%%%%%%%%%%%
L = 12; g = 32.2; a = 3;
theta = 0:0.01:pi/2;
omega = sqrt(3/L*(g*(1-cos(theta))+a*sin(theta)));
plot(theta*180/pi,omega)
xlabel('theta (deg)')
ylabel('omega (rad/s)')
%%%%%%%%%%%%%%%%%end of script %%%%%%%%%%%%%%%%%
v A = CA = 2 cos
v B = CB = 2 sin
1
1
mv 2 + I 2 ]
2
2
T =
1 40
(2 cos )2 + 1 1 40 4 2 2
2 12 32.2
2 32.2
T = 0.8282 4 3 cos 2 2
[ V g = Wh]
= 9.829
1 cos
4 3 cos 2
(b) After the spring is engaged (48.6 90). The kinetic and potential
energies are the same as in part (a). At any angle , point A has moved 2sin feet
to the left. Thus, the spring is compressed by 2sin 18/12 feet.
1
[V e = kx 2 ]
2
1 lb in
18
Ve = 30 12 2 sin 0
2 in ft
12
Ve = 180 2 sin
2
= 2.457
MATLAB Scripts
In the following, terms ending with _a are for part (a) where is between 0 and
48.6 while terms ending with _b are for part (b) where is greater than 48.6.
%%%%%%%%%%%%%%%% Script #1 %%%%%%%%%%%%%%%%%
% This script solves the energy equation for omega
% for cases a and b
syms theta omega
DT = 0.8282*(4-3*cos(theta)^2)*omega^2;
DVg = 80*(cos(theta)-1);
DVe = 180*(2*sin(theta)-3/2)^2;
U12_a = DT + DVg
U12_b = DT + DVg + DVe
omega_a = solve(U12_a,omega)
omega_b = solve(U12_b,omega)
%%%%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%
Note that for stiff springs, the angular velocity goes to zero before reaching =
90. The physical explanation for this is that, for a stiff spring, the bar will
rebound before it reaches the horizontal position.
v
+ mv(r h )
r
We will use primes to denote the state immediately after impact. Since the wheel
now rotates about A we can use the simpler formula H A = I A . Note that, by the
H A = I A = k 2 + r 2
r
v = v 1 2
2
k +r
1
I A 0 2 2 + mgh
2
1
v
m k 2 + r 2 = mgh
2
r
Substituting the result for v into the above equation followed by simplification
yields,
v=
r 2 gh k 2 + r 2
k + r rh
2
MATLAB Scripts
%%%%%%%%%%%%%%% Script #1 %%%%%%%%%%
% symbolic solution for v
syms m g k r h v vp
Ib = m*k^2; IA = m*(k^2+r^2);
HA = Ib*v/r+m*v*(r-h);
HAp = IA*vp/r;
vp = solve(HA-HAp,vp) % conservation of angular momentum
eqn = 1/2*IA*vp^2/r^2-m*g*h; % work/energy
solve(eqn,v)
%%%%%%%%%%% end of script %%%%%%%%%%
Output of script #1
vp =
v*(k^2+r^2-r*h)/(k^2+r^2)
ans =
(2*g*h*r^2+2*g*h*k^2)^(1/2)*r/(k^2+r^2-r*h)
-(2*g*h*r^2+2*g*h*k^2)^(1/2)*r/(k^2+r^2-r*h)
The first solution is the one we want.
%%%%%%%%%%%%%%% Script #2 %%%%%%%%%%
% This script plots v versus h for the specified values of k.
% The result for v below was obtained by substituting g = 9.81
% and r = 1 in to the symbolic result found in script #1
v = inline('4.429*sqrt(h+h*k^2)/(1+k^2-h)');
v = vectorize(v); % puts .s in expression
h = 0:0.01:1;
plot(h,v(h,1/2),h,v(h,3/4),h,v(h,1))
xlabel('h (m)')
ylabel('v (m/s)')
%%%%%%%%%%% end of script %%%%%%%%%%
Our analysis will follow closely that in the sample problem in your text.
vA = vB + nrA/B
where vA = 502j
vB = 6di
50 2 j = 6di + nx
50
ny nz
100
Expanding the determinant and equating the i, j, and k components yields the
following three equations
d 6 + ny 100 nz = 0
50( 2 nz ) + d nx = 0
2 nx ny = 0
At this point we have three equations with four unknowns. As explained in the
sample problem in your text, the fourth equation comes by requiring n to be
normal to vA/B
2
2
n = nx2 + ny
+ nz
MATLAB Scripts
%%%%%%%%%%%%%%%% Script #1 %%%%%%%%%%%%%%%%%%
% This script solves four equations for
% omega_2 (w) and the three components of
% omega_n (x, y, and z). The magnitude of
% omega_n is then found from its components.
syms w x y z d
eqn1 = d*(6+y)-100*z;
eqn2 = 50*(w-z)+d*x;
eqn3 = 2*x-y;
eqn4 = 50*x+100*y+d*z;
[w,x,y,z]=solve(eqn1,eqn2,eqn3,eqn4)
omega_n = sqrt(x^2+y^2+z^2);
omega_n = simplify(omega_n)
%%%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%
Output of script #1
w = 3/50*d
(2)
x = -3*d^2/(d^2+12500)
y = -6*d^2/(d^2+12500)
z = 750*d/(d^2+12500)
omega_n = 3*5^(1/2)*(d^2/(d^2+12500))^(1/2)
(n)
T=
1
I zz 2
2
The moments and products of inertia for part A remain unchanged. For part B, mB
= 70ab where a and b are in meters. The moments and products of inertia for part
B are
I zz = I zz + md 2 =
mB 2
a
2
a + m B (.125) +
12
2
a b
I xz = I xz + md x d z = 0 + m B
2 2
b
I yz = I yz + md y d z = 0 + m B (0.125)
2
The total moment and products of inertia are found by adding the above to those
found for part A (see the sample problem in your text). After substituting for mB
and simplifying we have,
I zz = 0.00456 + 1.094ab + 23.33a 3b
I xz = 17.5a 2 b 2
I yz = 0.00273 + 4.375ab 2
Part (a)
The most efficient way to show the acceptable ranges for a and b is to find the
required relationship between these two dimensions in order to satisfy the upper
and lower bounds on T. This is accomplished by substituting these bounds for T
in the equation above and then solving that equation for b as a function of a. To
illustrate, consider the lower limit on T (15 J). Substituting T = 15 into the
equation above gives
1
2
I zz (30 ) = 2.052 + 492.2ab + 10,500a3b
2
0.078921
(for T = 15 J)
b=
a 3 + 64a 2
T = 15 =
Solving for b,
0.17035
a 3 + 64a 2
(for T = 30 J)
Plotting these two functions defines the acceptable regions for a and b.
Part (b)
This is similar to (a) except that we solve two equations (T = 40 and H0 = 5)
simultaneously for two unknowns, a and b. The result is a = 0.1211 m and b =
0.4852 m.
MATLAB Scripts
%%%%%%%%%%%%%%% Script #1 %%%%%%%%%%%%%%%%%%%%%%
% The first part of this script solves the equations
% T = 15 and T = 30 symbolically for b in terms of a.
% These two results are named b15 and b30 respectively.
% When using the symbolic solve it is best to rewrite
% the equations in the form expression = 0. The "=0"
% is automatically understood by MATLAB and doesn't
% have to be typed in. In the following, our two
% expressions are named eqn1 and eqn2.
syms a b
mB = 70*a*b;
omega = 30;
Izz = mB/12*a^2+mB*(0.125^2+(a/2)^2)+0.00456;
Ixz = mB*a/2*b/2;
Iyz = mB*0.125*b/2+0.00273;
H0 = omega*sqrt(Ixz^2+Iyz^2+Izz^2)
T = 1/2*Izz*omega^2
eqn1 = T - 15;
eqn2 = T - 30;
b15 = solve(eqn1,b)
b30 = solve(eqn2,b)
% This part of the script solves the two equations
% for part b.
eqn3 = T - 40;
eqn4 = H0 - 5;
[a,b]=solve(eqn3,eqn4)
%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%%%%%%%
Output of script #1
H0 =
1/10000*(27562500000000*a^4*b^4+1722656250000*a^2*b^4+2149875000*a*b^2+25
42185+49000000000000*a^6*b^2+4593750000000*a^4*b^2+19152000000*a^3*b+107
666015625*a^2*b^2+897750000*a*b)^(1/2)
T = 2625*a^3*b+31500*a*b*(1/64+1/4*a^2)+513/250
b15 = 8632/109375/a/(64*a^2+3)
b30 = 18632/109375/a/(64*a^2+3)
a=
-.118672955347671873813795187
-.924961825359232183759243317e-1-.20405912363720769438094726*i
-.924961825359232183759243317e-1+.20405912363720769438094726*i
-.257514497287494286960690298e-2-.25491731461066579787563883*i
-.257514497287494286960690298e-2+.25491731461066579787563883*i
.349640543257908784471004656e-2-.265040090095767094717337313*i
.349640543257908784471004656e-2+.26504009009576709471733731*i
.903798369106820783468910094e-1-.204312206452426767071840559*i
.9037983691068207834689100945e-1+.2043122064524267670718405*i
.121063125678745863921655544
b=
-.499591682557401531621796988
.286519678237340239067367533+.281089760611403745879347469*i
.286519678237340239067367533-.281089760611403745879347469*i
.64375775885513160849563080e-1-.778487038145858201006376746*i
.64375775885513160849563080e-1+.77848703814585820100637674*i
-.5367082781855869430616764e-1-.579398660286892007965618348*i
-.5367082781855869430616764e-1+.57939866028689200796561834*i
-.29810587868680635995547322+.28455901589818267092944534*i
-.29810587868680635995547322-.284559015898182670929445341*i
.485167563521434010754982656
We see from the above that MATLAB has found ten solutions to our equations.
Of these only the first and last are real. The first solution has negative values for
a and b and thus can be excluded. This leaves only the last solution,
a = 0.1211 m; b = 0.4852 m
%%%%%%%%%%%%%%% Script #2 %%%%%%%%%%%%%%%%%%%%%%
% This script plots the two expressions for b
% obtained with script #1
a = 0.01:0.001:0.2;
b15 = 8632/109375./a./(64*a.^2+3);
b30 = 18632/109375./a./(64*a.^2+3);
plot(a, b15, a, b30)
xlabel('a (m)')
The two curves above represent the values of a and b for which T is exactly 15 or
30 J. Thus, the acceptable values of a and b satisfying the condition 15 T 30
J are all those combinations lying on or between the two curves.
As
From the initial conditions x 0 = 0.2 and x& 0 = 0 we find C = 0.207 m and =
1.318 rad.
(b) = 1. For = 1, the system is critically damped. The displacement and
velocity are
x = ( A1 + A2 t )e n t = ( A1 + A2 t )e 2t
x& = A2 e 2t 2( A1 + A2 t )e 2t
From the initial conditions x 0 = 0.2 and x& 0 = 0 we find A1 = 0.2 m and A2 = 0.4
m/s.
(c) = 1.75. Since > 1, the system is overdamped. The displacement and
velocity are
+ 2 1 t
n
x = B1 e
2 1 t
n
+ B2 e
= B1 e 0.628t + B 2 e 6.372 t
From the initial conditions x 0 = 0.2 and x& 0 = 0 we find B1 = 0.222 m and B2 =
0.0219 m/s.
MATLAB Script
%%%%%%%%%%%%%%% Script %%%%%%%%%%%%%%%%%%%%%%
t=0:0.01:5;
C = 0.207; psi = 1.318;
xa = C*sin(1.937*t+psi).*exp(-t/2);
A1 = 0.2; A2 = 0.4;
xb = (A1+A2*t).*exp(-2*t);
B1 = 0.222; B2 = -0.0219;
xc = B1*exp(-0.628*t)+B2*exp(-6.372*t);
x0 = 0.*t;
plot(t,xa,t,xb,t,xc,t,x0)
xlabel('time (sec)')
ylabel('x (m)')
%%%%%%%%%%%% end of script %%%%%%%%%%%%%%%%%%
Start with the equation for the critically damped case on page 606 of your text.
x = ( A1 + A2 t )e nt
First we have to evaluate the constants in terms of x0 using the initial conditions.
This will require the derivative of x.
x& = A2 e nt ( A1 + A2 t ) n e nt
Now, substituting the initial conditions,
x(t = 0 ) = x0 = A1
x& (t = 0) = 0 = A2 A1 n
These two equations give
A1 = x 0 and A2 = x0 n
x = ( x0 + x 0 n t )e nt
or
= (1 + n t )e nt
0.1 = (1 + 4t )e 4t
For part (b) we will simply plot for three different natural frequencies n .
The particular (steady state) solution was found in the sample problem in your
text,
x p = X sin(t )
where X = 0.01938 m, = 1.724 rad and = 30 rad/sec. Also from the sample
problem, n = k / m = 27.8 rad/sec and = c/2mn = 0.492.
The complete solution is found by adding the complementary (transient) and
particular solutions. Since the system is underdamped ( < 1), the complementary
solution is,
x c = Ce n t sin( d t + )
where d = n 1
x = x c + x p = Ce n t sin( d t + ) + X sin (t )
x = Ce 13.68t sin( 24.2t + ) + 0.01938 sin(30t 1.724)
1.675
x& 0 + 1.035
= tan 1
C=
0.0692
sin
Notice how quickly the three cases converge to the steady state solution.