You are on page 1of 30

Solving the Harmonic

Oscillator Equation
Morgan Root
NCSU Department of Math
Spring-Mass System
Consider a mass attached to a wall by means of a
spring. Define y=0 to be the equilibrium position of
the block. y(t) will be a measure of the displacement
from this equilibrium at a given time. Take
. and ) 0 (
0
) 0 (
0
v y y
dt
dy
= =
Basic Physical Laws
Newtons Second Law of motion states tells us that the
acceleration of an object due to an applied force is in the
direction of the force and inversely proportional to the mass
being moved.
This can be stated in the familiar form:
ma F
net
=
In the one dimensional case this can be written as:
y m F
net
& &
=
Relevant Forces
HookesLaw (k is
called Hookes
constant)
Friction is a force that
opposes motion. We
assume a friction
proportional to
velocity.
ky F
H
=
y c F
F
&
=
Harmonic Oscillator
Assuming there are no other forces acting on the
system we have what is known as a Harmonic
Oscillator or also known as the Spring-Mass-
Dashpot.
) ( ) ( ) (
or
t y c t ky t y m
F F F
F H net
& & &
=
+ =
Solving the Simple Harmonic System
0 ) ( ) ( ) ( = + + t ky t y c t y m
& & &
If there is no friction, c=0, then we have an Undamped
System, or a Simple Harmonic Oscillator. We will
solve this first.
0 ) ( ) ( = + t ky t y m
& &
Simple Harmonic Oscillator
t) K ( y(t) t) K ( y(t)
t Ky t y
K
m
k
cos and sin
equation. this
solve that will functions least two at know We
) ( ) (
: system
at the look and can take that we Notice
= =
=
=
& &
Simple Harmonic Oscillator
. Where
) sin( ) cos( ) (
cos. and sin of n combinatio
linear a is solution general The
0
0 0
m
k
t B t A t y
=
+ =


Simple Harmonic Oscillator
( )
0
0 0
0
0
1 2 2
0
0
0
tan and ) (
and where
) sin( ) (
as solution the rewrite can We
v
y v
m
k
y
t t y

= + =
=
+ =
Visualizing the System
0 2 4 6 8 10 12 14 16 18 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Undamped SHO
Time
D
i
s
p
l
a
c
e
m
e
n
t
m=2
c=0
k=3
Alternate Method:
The Characteristic Equation
0
: have e equation w the into this Subbing
) ( and ) (
. ) ( solution, l exponentia an Assume
0 ) ( ) (
: system at the look and take Again we
2
0
2
2
2
0
0
= +
= =
=
= +
=
rt rt
rt rt
rt
m
k
e e r
e r t y re t y
e t y
t y t y

& & &


& &
Alternate Method:
The Characteristic Equation
0 0
) ( and ) (
solutions two have we Thus

that require e solution w a have To
0
2
0
2

i i
e t y e t y
i r
r

= =
=
=
Alternate Method:
The Characteristic Equation
As before, any linear combination of solutions is a
solution, giving the general solution:
t i t i
e B e A t y
0 0
* *
) (

+ =
Eulers Identity
Recall that we have a
relationship between e
and sine and cosine,
known as the Euler
identity.
Thus our two solutions
are equivalent
( ) ( )
( ) ( ) t i t e
t i t e
t i
t i
0 0
0 0
sin cos
and
sin cos
0
0

=
+ =

Rewrite the solution


) sin( ) (
sine with one and
) (
ls exponentia complex with One
0
: to solutions two have now We
0
* *
0 0


+ =
+ =
= +

t t y
e A e A t y
ky(t) (t) y m
t i t i
& &
Damped Systems
If friction is not zero then we cannot used the same
solution. Again, we find the characteristic equation.
rt rt
rt
e r t y re t y
e t y
2
) ( and ) (
then,
) ( Assume
= =
=
& & &
Damped Systems
0
if only work can Which
0
have, we and , in Subbing
0 ) ( ) ( ) (
: o solution t a for looking now are hat we Remember t
2
2
= + +
= + +
= + +
K Cr r
Ke Cre e r
y y y
t Ky t y C t y
rt rt rt
& & &
& & &
Damped Systems
d underdampe 0 3.
damped critically 0 2.
overdamped 0 1.
options three have We
4 Let
where
: that us gives This
2
0
2
0
2
4
2
0
2
<
=
>
=
= =

C
r
m
k
C C
UnderdampedSystems
The case that we are
interested in is the
underdampedsystem.
0 4
2
0
2
< C
m
c mk
C
C K
t B t A e t y
Be Ae t y
i C i C
2
4
2
2
1
2 /
2
2 2
4
)), sin( ) cos( ( ) (
or
) (
is solution The

= =
+ =
+ =
+



UnderdampedSystems


0
2
0
2
and
), ( tan ,
,
2
4
Where
) sin( ) (
form, intuitive more a in this rewrite can We
0
1 2 2
2
y v
B
A
t
m
c
m
c
B y A
B A
m
c mk
t e t y
+

= =
= + =

=
+ =

Visualizing UnderdampedSystems
0 2 4 6 8 10 12 14 16 18 20
-1.5
-1
-0.5
0
0.5
1
1.5
2
Underdamped System
Time
D
i
s
p
l
a
c
e
m
e
n
t
m=2
c=0.5
k=3
Visualizing UnderdampedSystems
0 2 4 6 8 10 12 14 16 18 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Time
D
i
s
p
l
a
c
e
m
e
n
t
Underdamped Harmonic Oscillator
y(t)=Ae
-(c/2m)t

y(t)=-Ae
-(c/2m)t

m=2
c=0.5
k=3
Visualizing UnderdampedSystems
0 2 4 6 8 10 12 14 16 18 20
-0.5
0
0.5
1
1.5
2
Another Underdamped System
Time
D
i
s
p
l
a
c
e
m
e
n
t
m=2
c=2
k=3
Visualizing UnderdampedSystems
0 2 4 6 8 10 12 14 16 18 20
-2.5
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
Time
D
i
s
p
l
a
c
e
m
e
n
t
y(t)=Ae
-(c/2m)t

y(t)=-Ae
-(c/2m)t

m=2
c=2
k=3
Underdamped Harmonic Oscillator
Will this work for the beam?
The beam seems to fit the harmonic
conditions.
Force is zero when displacement is zero
Restoring force increases with displacement
Vibration appears periodic
The key assumptions are
Restoring force is linear in displacement
Friction is linear in velocity
Writing as a First Order System
Matlab does not work with second order equations
However, we can always rewrite a second order ODE as a
system of first order equations
We can then have Matlab find a numerical solution to this
system
Writing as a First Order System
) ( ) ( ) (
and
) ( ) (
Clearly,
). ( ) ( and ) ( ) ( let can We
) 0 ( and ) 0 ( with , 0 ) ( ) ( ) (
ODE order second Given this
2 1 2
2 1
2 1
0 0
t Cz t Kz t z
t z t z
t y t z t y t z
v y y y t Ky t y C t y
=
=
= =
= = = + +
&
&
&
& & & &
Writing as a First Order System
Matlab. in work that will form a in now is This
with
1 0
where
or
) (
1 0
) (
form vector -
matrix in equation the rewrite can we Now
0
0
2
1
2
1

=
v
y
C K
t
z
z
C K
t
z
z
z(0)
A Az(t) z(t)
&
&
Constants Are Not Independent
Notice that in all our solutions we never have
c, m, or k alone. We always have c/mor k/m.
The solution for y(t) given (m,c,k) is the same
as y(t) given (m, c, k).
Very important for the inverse problem
Summary
We can used Matlab to generate solutions to
the harmonic oscillator
At first glance, it seems reasonable to model a
vibrating beam
We dont know the values of m, c, or k
Need the inverse problem

You might also like