You are on page 1of 9

Differential Equation Model.

A coupled mass-spring system with damping and


external force is modeled by a single second order
differential equation for the displacement from the
equilibrium position, y(t),
m y'' +c y' +k y =f(t) and y(0),y'(0) are given.

m =mass

c =damping constant

k =spring constant

y =y(t) =velocity and

y =y(t) =acceleration.
The above second order differential equation can be
equivalently written as a coupled system of two
differential equations for
y
1
(t) =y(t) and y
2
(t) =y'(t).
By definition the derivative of y
1
must be y
2
.
The derivative of y
2
is y'', which we can solve for via
the second order differential equation. Thus, the
equivalent coupled system is
y
1
' =y
2
with
y
1
(0) =y(0) =the initial position and
y
2
' =(f(t) - c y
2
- k y
1
)/m with

y
2
(0) =y'(0) =the initial velocity.


Method of Solution.

Consider the special case with no damping and a trig

function for the external force

c =0

f(t) =F
0
cos(t).

If does not equal (k/m)
1/2
, then the solution is

y(t) =F
0
/(k - m
2
) (-cos ((k/m)
1/2
t) +cos(t)).

If does equal (k/m)
1/2
, then the solution is

Y(t) =F
0
/(2(km)
1/2
) t sin((k/m)
1/2
t).

In the last case, the amplitude of the sin() function

blows up! Even if this particular case is not precisely

satisfied, the amplitude may become so large that the

spring breaks. In these other cases the exact

solution of the ODE may be difficult to find, and

therefore, we will use numerical techniques.

Matlabs ode45 will be used so solve the system

version of the ODE.


Matlab Implementation.

Use the m-files ypms.m and ms.m.

In the calculation we used m =1, c =0 , k =1, f (t) =1
cos(1 t) with initial position and velocity set equal to
0.

In subsequent calculations we let c =.1 and 1. where
the third line in the ypms.m must be changed to, for c
=.1,
ypms(2) = cos(1*t) - y(1) - .1*y(2);
function ypms = ypms(t,y)
ypms(1) = y(2);
ypms(2) = cos(1*t) - y(1);
ypms = [ypms(1) ypms(2)]';



%your name, your student number,
lesson number
clear;
t0 = 0;
tf = 100;
y0 = [0 0];
[t y] = ode45('ypms', [t0 tf],y0);
plot(t,y(:,1))
title( 'your name, your student
number, lesson number')
xlabel('time')
ylabel('displacement')
%plot(y(:,1),y(;,2));
0 10 20 30 40 50 60 70 80 90 100
-50
-40
-30
-20
-10
0
10
20
30
40
50
your name, your student number, lesson number
time
d
i
s
p
l
a
c
e
m
e
n
t


Figure: m = 1, c = 0.0 and k = 1
0 10 20 30 40 50 60 70 80 90 100
-10
-8
-6
-4
-2
0
2
4
6
8
10
your name, your student number, lesson number
time
d
i
s
p
l
a
c
e
m
e
n
t

Figure: m = 1, c = .1 and k = 1
0 10 20 30 40 50 60 70 80 90 100
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
your name, your student number, lesson number
time
d
i
s
p
l
a
c
e
m
e
n
t

Figure: m = 1, c = 1. and k = 1

You might also like