Mathcad - Solution of ODEs

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Mathcad Tutorial on Solution of Ordinary Differential Equations

Vibration of a Mass-Spring-Damper System

d2 d
m x  c x  k x = f ( t) = sin ( 5 t)
2
dt dt

tf  40 m  1 c  0.3 k  4 ω  5

Given

d2 d
m x ( t)  c x ( t)  k x ( t) = sin ( ω t)
2
dt dt

x ( 0) = 0.1 x' ( 0) = 0.05

x  Odesolve t tf  
0.2

0.1

x ( t) 0

 0.1

 0.2
0 10 20 30 40
t
Other Solvers can as well be used such as

Adams, rkfixed, Rkadapt, Bulstoer, Radau


ODEs should be first order
d
Let x = y1 x ( t) = y2
dt
d
y1 ( t) = y2
dt

 
d 1
y2 ( t) =  sin ( ω t)  c y2 ( t)  k y1 ( t)
dt m

Middle East Technical University, METU, Ankara/TURKEY 1 Dr. Ender CİĞEROĞLU


Mathcad Tutorial on Solution of Ordinary Differential Equations

0.1   x ( 0) = y1 ( 0) 
Initial Conditions IC     
 0.05   x' ( 0) = y2 ( 0) 
 
 y1 
Set of ODEs 
D ( t y)  1 
   sin ( ω t)  c y1  k y0 
m 
ts  0 tf  40 NN  500 The integer number of discretization intervals
(NN-1) used to interpolate the solution function.


S  Adams IC ts tf NN D 
X  S1 T  S0 X'  S2 t  ts ts  0.01  tf

0.2

0.1

X
0
x ( t)

 0.1

 0.2
0 10 20 30 40
T t

0.2

0.1

X
0
x ( t)

 0.1

 0.2
0 1 2 3 4 5
T t

Middle East Technical University, METU, Ankara/TURKEY 2 Dr. Ender CİĞEROĞLU


Mathcad Tutorial on Solution of Ordinary Differential Equations

For Stiff Problems the Following Solvers can be Used

BDF, Radau, Stiffb, Stiffr


AdamsBDF : is a hybrid solver. It uses Adams for non-stiff problems and BDF for
stiff problems. It automatically determines whether a system is stiff or
non-stiff.

d f ( t)  
f ( t) = k  u ( t)   atanh 
d 1
Friction element given below can be represented by 
dt  dt α  μ N  
where f(t) is the friction force and u(t) is the input motion (x) to the friction element.

NN  1000

k  103 μ  1 N  600 u ( t)  1 sin ( t) α  104 Nn  103


d π f 
F ( t f )  k  u ( t)   tan  
1
 t0  0 f0  0 t1  15
 dt α  2 μ N  
d π f 
D ( t f )  k  u ( t)   tan  
1
 IC  0 ts  0 tf  15
 dt α  2 μ N  

S  rkfixed IC ts tf NN D  
S2  BDF IC ts tf NN D 
Y1  S1 T1  S0 Y2  S21 T2  S20

Middle East Technical University, METU, Ankara/TURKEY 3 Dr. Ender CİĞEROĞLU


Mathcad Tutorial on Solution of Ordinary Differential Equations

3
110
Non-stiff Solver
Stiff Solver
Force

0 IC

 1103
0 5 10 15

Time

3
110
Non-stiff Solver
Stiff Solver
Force

0 IC

3
 110
1  0.5 0 0.5 1

Displacement
As can be seen from the solutions, the non-stiff solver "rkfixed" cannot detect the stick slip
transitions correctly. Therefore, one should use a stiff solver such as "BDF" in order to
obtain the correct solution of a stiff problem. For stiff problems, non-stiff solvers require
very small time steps which are not practical in most situations.

Middle East Technical University, METU, Ankara/TURKEY 4 Dr. Ender CİĞEROĞLU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy