Mathcad - Example of Using Laplace Transforms To Solve An ODE
Mathcad - Example of Using Laplace Transforms To Solve An ODE
Sol ve an ODE
This worksheet illustrates Mathcad's ability to symbolically solve an ordinary differential equation using Laplace
transforms. Note that all equations have been formatted to display the regular equals sign even though, for
example, they may actually be equalities (bold-equals). This may be changed by using menu item Tools ...
Worksheet Options. In this example, from dynamics, we wish to find the motion x(t) of a mass m attached to a
spring (strength k) and dashpot (coefficient c) due to a known applied force F(t).
F(t)
x(t)
k
c
m
For c ed Vi br at i ons
Consider forced vibration of a spring-mass-dashpot system:
Data:
m 5 = k 1 = c 1 = x
0
0 = x'
0
0 =
F
max
1 = 1 = (Used for F(t))
Equation Set:
The equation of motion is: mx'' t ( ) c x t ( ) + k x t ( ) + F t ( ) = x 0 ( ) x
0
= x' 0 ( ) x'
0
=
with F t ( ) F
max
1 e
t
( )
=
To use the Laplace transform method we typically:
a) Convert each differential of x(t) into a corresponding algebraic expression in s space (using X(s) as the transform
of x(t)); also find the Laplace transform of F(t) (the transform is called f(s).
b) Assemble the Laplace transform of the equation of motion to obtain an algebraic equation for X(s)
c) Solve the algebraic equation for X(s)
d) Transform X(s) back into the solution x(t)
The easiest part (and ironically the part that Mathcad can't do for you!), is the first part of a). However, the
following expression can be used:
x
n ( )
s
n
X s ( ) s
n 1
x 0 ( ) s
n 2
x' 0 ( ) ... x
n 1
= for n 1 >
where x
(n)
represents the n
th
derivative. For example: x'' s
2
X s x 0 ( ) x' 0 ( ) =
The Laplace transform of the applied force is needed: f s ( ) F t ( ) laplace t ,
1
s s 1 + ( )
= =
The solution can then be obtained (in one step!) using Mathcad:
x t ( ) m s
2
X s x
0
x'
0
( )
c s X x
0
( )
+
...
k X f s ( ) +
...
solve X ,
expand s ,
invlaplace s ,
1
4e
t
10
cos
19t
10
|
\
|
|
.
14 19 e
t
10
sin
19t
10
|
\
|
|
.
95
e
t
5
= =
Note that this could have been done with m, c etc. remaining in symbolic form; however, the solution would then be
long to display.
The results can be plotted: t 0 0.1 , 30 .. =
0 10 20 30
0.5
1
1.5
Force
Motion