You are on page 1of 9

MAE 653-1 Advanced Vibration

Spring 2010


Lesson #6 Thrusday, Jan. 28, 2010
Textbook Sections 11.4 11.4 / 2.9

Numerical Solution of SDOF Systems
Hermann E. Alcazar
6. Numerical solution of SDOF systems MAE 653 - Advanced Vibrations/Fall 2010
11.2 Finite difference method. Taylor series expansion and discrete derivative
+ ' ' '

+ ' '

+ '

+ = + ) (
! 3
) (
) (
! 2
) (
) (
! 1
) (
) ( ) (
3 2
a f
a x
a f
a x
a f
a x
a f a x f

= A
= A +
=

+
1
1
) (
) (
) (
i
i
i
x t t f
x t t f
x t f
h
x x
x
h
x x
x
h
x x
x
i i
i
i i
i
i i
i
2
1 1
1
1
+



+ + =
+ + + + =

+
i i i i i
i i i i i
x
h
x
h
x h x x
x
h
x
h
x h x x
6 2
6 2
3 2
1
3 2
1
2
1 1
2
2 1
2
1 2
2
2
2
h
x x x
x
h
x x x
x
h
x x x
x
i i i
i
i i i
i
i i i
i
+

+ +
+
=
+
=
+
=



Forward-difference
Backward-difference
Central-difference
The first and second derivatives can be expressed as:
After a discretization of a function is done, its Taylor
series expansion can be expressed in terms of the i-th
point.
In general, the Taylor series expansion is expressed as
6. Numerical solution of SDOF systems MAE 653 - Advanced Vibrations/Fall 2010
11.3 Finite difference method. Equation of motion explicit solution / central difference method
( )
0 0 0 0
1
x k x c F
m
x =
i i
i i i i i
F x k
t
x x
c
t
x x x
m = +
)
`

+
)
`

A
+
+ +
2 ) (
2
1 1
2
1 1

A
+
=
A

2
1 0 1
0
1 1
0
) (
2
2
t
x x x
x
t
x x
x

) (t F x k x c x m = + +
The equation of motion of a viscously damped SDOF system with forced vibration is
When the central differences replaces the derivatives, the expression around point i is
(

+
|
|
.
|

\
|

A
+
|
|
.
|

\
|
A
+
A
|
|
|
|
.
|

\
|
A
+
A
=
+ i i i i
F x k
t
m
x
t
m
t
c
t
c
t
m
x
2
1
2
2
1
) (
2
) ( 2
2 ) (
1
The solution of the point i+1 can be obtained using the known data at the previous points i and i-1,
A fictitious point -1 can be defined after using the initial conditions,
0
2
0 0 1
2
) (
x
t
x t x x
A
+ A =

6. Numerical solution of SDOF systems MAE 653 - Advanced Vibrations/Fall 2010


11.4 Runge-Kutta method. Explicit integrations methods.
m t y f
t d
y d
= = ) , (
k
t
1 + k
t
( ) h t
k 2
1
+
2
m
1
m
1 + k
y
k
y
t
) (t y
h
k
t
1 + k
t
1
m
1 + k
y
k
y
t
) (t y
h
) (
2
1 1
h O k y y
k k
+ + =
+
( )
( ) h t k y f h k
t y f h k
k k
k k
2
1
1 2
1
2
1
,
,
+ + =
=
) (
3
2 1
h O k y y
k k
+ + =
+
( )
k k
t y f h k ,
1
= ( )
( )
( )
( )
1 3 4
2
1
2 2
1
3
2
1
1 2
1
2
1
,
,
,
,
+
+ =
+ + =
+ + =
=
k k
k k
k k
k k
t k y f h k
h t k y f h k
h t k y f h k
t y f h k
1
m m =
2
m m =
( ) ) ( 2 2
5
4 3 2 1 6
1
1
h O k k k k y y
k k
+ + + + + =
+
The numerical explicit methods for solving ordinary differential equations are methods of
integrating a system of first order differential equations of the form,
Euler Method
(1
st
-order Runge-Kutta)
Mid-point Method
(2
nd
-order Runge-Kutta)
Runge-Kutta Method
(4
th
-order Runge-Kutta)
k
t
1 + k
t
( ) h t
k 2
1
+
2
m
3
m
4
m
1
m
1 + k
y
k
y
t
) (t y
h
( )
4 3 2 1 6
1
2 2 m m m m m + + + =
6. Numerical solution of SDOF systems MAE 653 - Advanced Vibrations/Fall 2010
11.4 Runge-Kutta method. Explicit integrations methods.
The fourth-order Runge-Kutta method is unconditionally stable and has very good error
properties:
local error is O(h
5
)
global error is O(h
4
)
The RK method is stable and self starting, values of the previous step are needed.
Can be extend to n-sets of first-order ODEs with n-variables,
) , , , , (
) , , , , (
) , , , , (
2 1
2 1 2
2
2 1 1
1
t y y y f
t d
y d
t y y y f
t d
y d
t y y y f
t d
y d
n n
n
n
n

=
=
=
( ) t Y F
t d
Y d
,

=
( )
( )
( )
( )
1 3 4
2
1
2 2
1
3
2
1
1 2
1
2
1
,
,
,
,
+
+ =
+ + =
+ + =
=
k k
k k
k k
k k
t K Y F h K
h t K Y F h K
h t K Y F h K
t Y F h K




( )
4 3 2 1 6
1
1
2 2 K K K K Y Y
k k

+ + + + =
+

6. Numerical solution of SDOF systems MAE 653 - Advanced Vibrations/Fall 2010
11.4 Runge-Kutta method. Discretization of the equation of motion.
The second order differential equation is
reduced into two first-order equations, then:
)
`

=
=
=
x y
x y
Y

2
1
( )
( ) ( )

= = =
= = =
=
1 2 2 1 2
2
2 2 1 1
1
) (
1
, ,
, ,
y k y c t F
m
x t y y f
t d
y d
y x t y y f
t d
y d
F

) (t F x k x c x m = + +
)
`

=
0
0
0
x
x
Y

x y =
1 t 1 1 2
f x y y = = =
2 2
f x y f = = =
h t T
k 2
1
3
+ =
k
t T =
1
h t T
k 2
1
2
+ =
h t T
k
+ =
4
h Y x X
k 1 2
1
2
+ =
k
x X =
1
h Y x X
k 3 4
+ =
h Y x X
k 2 2
1
3
+ = ( )
3 3 3 3
, , T Y X f F =
( )
1 1 1 1
, , T Y X f F =
( )
2 2 2 2
, , T Y X f F =
( )
4 4 4 4
, , T Y X f F =
h F y Y
k 1 2
1
2
+ =
k
y Y =
1
h F y Y
k 2 2
1
3
+ =
h F y Y
k 3 4
+ =
( )
( )

+ + + +
+ + + +
=
)
`

=
)
`

=
+
+
+
+
+
4 3 2 1
4 3 2 1
1
1
2
1
1
2 2
6
2 2
6
1
1
F F F F
h
x
Y Y Y Y
h
x
x
x
y
y
Y
k
k
k
k
k
k
k


with IC:
6. Numerical solution of SDOF systems MAE 653 - Advanced Vibrations/Fall 2010
2.9 Examples using Matlab. ODE.
MATLAB does numerical solution of ODEs very well & has many specialized built-in routines.
MATLAB has a few different ODE solvers, including:
ode23: Uses simultaneously second and third order Runge Kutta formulas to make
estimates of the error, and calculate the time step size. Since the second and third order
RK require less steps, ode23 is less expensive in terms of computation demands than
ode45, but is also lower order. Use for non stiff ODEs.
ode45: Uses simultaneously fourth and fifth order RK formulas to make error estimates
and adjust the time step accordingly. MATLAB recommends that ode45 is used as a first
solver for a problem. For nonstiff ODEs.
ode113: Uses variable-order Adams-Bashforth-Moulton solver. For problems with
stringent error tolerances or for solving computationally intensive problems. For nonstiff
ODEs.
ode15s: If using ode45 turns out to be a slow process, then the DEs you are solving are
stiff. Use ode15s or one of the solvers: ode23s, ode23t, ode23tb.
The best starting point is ode45; works extremely well for all but the toughest problems.
Simplest syntax: [t,x]=ode45(@myf,tspan,x
0
):
Input arguments:
@myf: function myf.m holds the right-hand side function f
tspan=[t
0
t
f
]: time span to integrate over; from t = t
0
to t = t
f
x
0
: initial conditions (as a column vector)
Output
t: column vector of computed time points
x: matrix of corresponding solution values; ith-column x(:,i) is x
i
Time step is chosen automatically to keep error below tolerance.
6. Numerical solution of SDOF systems MAE 653 - Advanced Vibrations/Fall 2010
2.9 Examples using Matlab. Matlab code example.
clear;
%m=4; c=0; k=2000; % define constants
Tn=0.1; z=0.05;
wn=2*pi/Tn;
m=1;
k=m*wn^2;
c=2*z*wn*m;

to=0; tf=2; % define time span
uo=0; vo=0; % define initial conditions

[t,y]=ode23(@function_ode,[to,tf],[uo;vo],[],m,c,k);
figure(1)
plot(t,y(:,1))
xlabel('Time')
ylabel('Displacement')
figure(2)
plot(t,y(:,2))
xlabel('Time')
ylabel('Velocity')
function y_dot = function_ode(t,y,m,c,k)

F=[ 0 0;
0.0001 1;
0.75 1;
0.7501 -1;
1.5 -1;
1.5001 0;
2 0];
%f=spline(F(:,1),F(:,2),t); % discrete as spline
f=interp1(F(:,1),F(:,2),t,'linear'); % discrete as line
%f=sin(0.5*t); % continuous function

y_dot=[ y(2);
(f-c*y(2)-k*y(1))/m];
6. Numerical solution of SDOF systems MAE 653 - Advanced Vibrations/Fall 2010
2.9 Examples using Matlab. Matlab output graphs.
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
-8
-6
-4
-2
0
2
4
6
x 10
-4
Time
D
i
s
p
l
a
c
e
m
e
n
t
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
F
o
r
c
e
Time
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
-0.04
-0.03
-0.02
-0.01
0
0.01
0.02
0.03
Time
V
e
l
o
c
i
t
y

You might also like