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

y1(t) = y(t) and y2(t) = y'(t).

By definition the derivative of y1 must be y2.

The derivative of y2 is y'', which we can solve for via

the second order differential equation. Thus, the

equivalent coupled system is

y1' = y2 with

y1(0) = y(0) = the initial position and

y2' = (f(t) - c y2 - k y1)/m with

y2(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) = F0 cos(wt).

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

y(t) = F0/(k - m ω 2) (-cos ((k/m) 1/2t) + cos(ωt)).

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

Y(t) = F0/(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.

Matlab’s 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));
your name, your student number, lesson number
50

40

30

20

10
displacement

-10

-20

-30

-40

-50
0 10 20 30 40 50 60 70 80 90 100
time

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


your name, your student number, lesson number
10

2
displacement

-2

-4

-6

-8

-10
0 10 20 30 40 50 60 70 80 90 100
time

Figure: m = 1, c = .1 and k = 1
your name, your student number, lesson number
1

0.8

0.6

0.4

0.2
displacement

-0.2

-0.4

-0.6

-0.8

-1
0 10 20 30 40 50 60 70 80 90 100
time

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

You might also like