Beruflich Dokumente
Kultur Dokumente
Olson
Department of Mechanical, Industrial and Manufacturing Engineering
University of Toledo
Solving ODE
Simulink
SIMULINK
SIMULINK
SIMULINK
integration)
Eulers Method
Runga Kutta/Butcher Methods
Many other techniques (Adams-Bashforth, Adams-Milne, Hermite
Obreschkoff, Fehlberg, Conjugate Gradient Methods, etc.)
Numerical Methods
Solutions can be approximated using
numerical methods
Why Numerical Methods?
Analytical methods may not exist to solve for
Numerical Methods
Numerical methods follow the procedure
Step1: Initialize: Select some initial value
Step2: Estimate using (guess, some
analytical technique) a new value at
increment i
Step 3: Is the system converging? If not, use
something else. We usually know a priori
whether a method will converge or not form
mathematics. Therefore, this step is often
omitted.
Step 4: Is the change from the previous value
to current value smaller than our acceptable
error?
If not, make the current value the previous value and
numerical technique
simple
efficient
flexible
f(ti)
f (ti )
df (ti ) / dt
ti+1
ti
F ( s ) 5s 4 8s 3 15s 20 s 22
Example
si 1 si
F ( s ) s 5 2 s 4 5s 3 10s 2 22 s 48
To within 0.01 of the value of
s
F ( 1) 1 2 5 10 22 48 =32
F ( 1) 5 8 15 20 s 22 14
F ( si )
32
1
3.2857
F ( si )
14
3.2857 1 2.2857
F ( 3.2857) 243.53
F ( 3.2857) 417.2
si 1 2.702
F ( 2.702) 74.487
F ( 2.702) 186.17
0.4
F ( 2.302) 19.126
F ( 2.302) 98.266
si 1 2.107 0.195
F ( 2.302) 2.838
F ( 2.302) 70.164
si 1 2.067 0.04
F ( 2.067) 0.00219
F ( 2.067) 65.137
si 1 2.302
There appears to be a
si 1 2.065
dx n
dx n 1
dx n 2
dx
a0 n a1 n 1 a2 n 2 K an 1
an x ( t ) u ( t )
d t
d t
d t
dt
dia
Ra ia Kb d Va
dt
La La dt La
d 2 Kia b d
dt
J J dt
Solution Methods
To solve
dx n
dx n 1
dx n 2
dx
a0 n a1 n 1 a2 n 2 K an 1
a n x (t ) u (t )
d t
d t
d t
dt
We can use
Reduction in order
Undetermined coefficients
Variation of parameters
Laplace Transforms
Superposition of particular integrals
Cauchy-Euler equation
Numerical methods
Reduction of Order
The object is to reduce
H T cos
dy W
tan
dx H
W T sin ws
d 2 y 1 dW w ds w
dy
dx 2 H dx H dx H
dx
dy
dp w
Let p , then
1 p2
dx
dx H
dp
wdx
H
1 p2
wx
dy
wx
p
sinh
H
dx
H
wx
dy sinh dx
H
sinh 1 p
wx
cos
h
1
, a catenary
H
H
Homogenous Case
When
n
a0
n 1
n 2
dx
dx
dx
dx
a
an x (t ) 0
1
2
n
1
d nt
d n 1t
d n 2t
dt
p 1
y ci e
i 1
m p i 1t
p 2
v
m t
(k 0 k1 x k 2 x 2 ... k v j x j )e j e ah t lh1 sin bh t lh2 cos bh t
j 1
h 1
Homogenous Example
A weight of 15 Kgf is supported (x = 0, at rest,) by a spring
with a spring rate of 50 N/m. At t = 0, the weight is extended
by 20 centimeters and released.
Model and solve.
& bx& kx 0
mx&
15 y 2 17 y 50 0
17 172 4 *15*50
y1,2
2 *15
y1 0.5667 1.7356i
y2 0.5667 1.7356i
& kx 0
mx&
x (0) 0.2
x&(t ) 0
Euler Method
Our goal is to solve equations
of the form
dy
f ( x, y )
dx
Prediction
yi
yi+1
Error
yi+1
xi+1
xi
step h
Example
& bx& kx 0
mx&
15&
x& 17 x& 50 x 0
assume x = 0.2, x& 0 at t=0
try a time step h = 0.1
dx
dx& 17
50
x&,
x& x
dt
dt
15
15
1
0
r
x
d x
50
f
(
x
, t)
17
&
x
dt x&
15
15
x
x
d x
x&
x& h
i 1 x& i 0 dt
i 0
0
x
0.2
x&
0 50
i 1
15
x
x&
i2
0.2
0.0007
1
17
15
0
50
15
continuing :
x
x&
i 3
0
0.1999
50
0.0013
15
...
0.2
0.2
0.1
0.0007
1
17
15
0.2
0.1999
0.1
0.0007
0.0013
1
17
15
0.1999
0.1
0.0013
0.1999
0.002
Example
Try a smaller time
step,
say, h =
0.01seconds
The function
( xi , yi , h )
is called the
increment function
RK4 is a four factor
expansion of the
incrementing function
k1 k2 k3 k4
6 3 3 6For RK4:
k1 f ( xi , yi )
( xi , yi , h )
hk
h
k2 f ( xi , yi 1 )
2
2
hk
h
k3 f ( xi , yi 2 )
2
2
k4 f ( xi h, yi hk3 )
Example
& bx& kx 0
mx&
15&
x& 17 x& 50 x 0
f ( x , t ) 50
17
dt x&
x&
15
15
r
note: y x and x t for the RK4 formulae
r
k1 f (ti , xi )
1 0.2
0
0.6667
3.333 1.133 0
0
1 0.2
0
0.0333
h r hk
k 2 f (ti , xi 1 )
0.05
0.6667
0.629
2
2
3.333 1.133 0
0
1 0.2
0.0333
hk
h
k 3 f ( xi , y i 2 )
0.05
2
2
3.333 1.133 0
0.629
0.0314
0.625
1 0.2
0.0314
0.0625
0.1
0.625
0.585
3.333 1.133 0
k 4 f ( xi h, yi hk3 )
( xi , yi , h )
0
0.0320
1 0.0333
1 0.0625
k1 k2 k3 k4 1
1 0.0314
0.627
6 3 3 6 6 0.6667
3 0.625
3 0.629
6 0.585
Example
0
1 0.0333
1 0.0314
0.0320
k1 k2 k3 k4 1
1 0.0625
6 3 3 6 6 0.6667
6 0.585
3 0.629
3 0.625
0.627
0.1968
0.2 0.0320
yi 1 yi ( xi , yi , h ) h
* 0.1
0.0637
0 0.627
( xi , yi , h )
The result of the RK4 at h = 0.1 is essentially the same as the analytic solution:
Summary
Models for Control Systems are either differential
trajectories
Next Class: Analyzing stability