You are on page 1of 24

MCT 456 Dynamic Modeling and Simulation

Review of ODEs and Laplace


Transform
Dr. Ahmed Asker
Production and Mechanical Design Engineering
Department
Mansoura University
2019/2020
Ordinary Differential Equations

 An ordinary differential equation (ODE) is an equation


containing ordinary, but not partial, derivatives of the dependent
variable.
 Because the subject of system dynamics is time-dependent
behavior, the independent variable in our ODEs will be time t.
 We will often denote the time derivative with an over-dot, as
𝑑𝑥 𝑑2 𝑡
𝑥= 𝑥= 2
𝑑𝑡 𝑑𝑡
 Initial value problem is ODE+ Initial conditions
 Generally, all functions of the dependent variable are placed on
the left-hand side of the equal (=) sign.
3𝑥 + 7𝑥 + 2𝑡 2 𝑥 = 0 Homogeneous ODE
3𝑥 + 7𝑥 + 2𝑡 2 𝑥 = 5 + sin 𝑡 Nonhomogeneous ODE

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 2


Ordinary Differential Equations

INITIAL CONDITIONS
 ODE Problem: 𝑦 𝑡 = −0.1𝑦 𝑡 + 100𝑒 −0.1𝑡
 A range of Initial Conditions is specified (ICs):

𝑦0 = −1000: 50: 1000

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 3


Ordinary Differential Equations

SEPARATION OF VARIABLES
 Use separation of variables to solve the following problem for 𝑡
≥ 0.
𝑥 + 2𝑥 = 0, 𝑥 0 =3
Solution
𝑑𝑥
= −2𝑥
𝑑𝑡
𝑥(𝑡) 𝑡
𝑑𝑥
= −2 𝑑𝑡
3 𝑥 0
ln 𝑥(𝑡) − ln 3 = −2𝑡
𝑥 𝑡 = 3𝑒 −2𝑡

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 4


Ordinary Differential Equations

MATLAB Code
t=linspace(0,10,100);
Fun1=@(t,x) -2*x;
y=ode45(Fun1,t,3);
hold on
plot(y.x,y.y)
plot(t,3*exp(-2*t),'r--')
grid on
xlabel('t(s)');
ylabel('x(t)');

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 5


Ordinary Differential Equations

SEPARATION OF VARIABLES
 Use separation of variables to solve the following problem for 𝑡
≥ 0.
𝑥 + 2𝑥 = 20, 𝑥 0 =3
Solution

𝑥 𝑡 = 10 − 7𝑒 −2𝑡

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 6


Ordinary Differential Equations

MATLAB Code
t=linspace(0,10,100);
Fun1=@(t,x) -2*x+20;
y=ode45(Fun1,t,3);
hold on
plot(y.x,y.y)
plot(t,10-7*exp(-2*t),'r--')
grid on
xlabel('t(s)');
ylabel('x(t)');

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 7


Ordinary Differential Equations

TRIAL-SOLUTION METHOD (First order equations)


 For 𝑎 ≠ 0 solution of the equation
𝑥 + 𝑎𝑥 = 𝑏
 Its solution has the form
𝑥 𝑡 = 𝐶 + 𝐷𝑒 𝑠𝑡
where 𝐶, 𝐷, and 𝑠 are constants to be determined.

 The only way this equation can be true is if 𝑠 + 𝑎 = 0 and 𝑎𝐶 =


𝑏. Thus 𝑠 = −𝑎 and 𝐶 = 𝑏/𝑎. The remaining constant, 𝐷, can be
determined from the initial value 𝑥(0) as follows.

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 8


Ordinary Differential Equations

TRIAL-SOLUTION METHOD (Second order equations)


𝑎𝑥 + 𝑏𝑥 + 𝑐𝑥 = 0
 Let 𝑥 𝑡 = 𝑒 𝑟𝑡
𝑒 𝑟𝑡 𝑎𝑟 2 + 𝑏𝑟 + 𝑐 = 0
Because 𝑒 𝑟𝑡 is never zero
𝑎𝑟 2 + 𝑏𝑟 + 𝑐 = 0
Now the auxiliary (characteristic) equation is just a quadratic, and
its roots are

The solution of the equation can be given as


𝑥 𝑡 = 𝑐1 𝑦1 𝑡 + 𝑐2 𝑦2 (𝑡)

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 9


Ordinary Differential Equations

 Solve the following problem for 𝑡 ≥ 0.


𝑥 + 2𝑥 − 𝑥 = 0, 𝑥 0 = 0, 𝑥 0 = −1
𝑟 2 + 2𝑟 − 1 = 0
−2 ± 44 + 4
𝑟1,2 = = −1 ± 2
2
𝑥 𝑡 = 𝑐1 𝑒 −1+ 2 𝑡 + 𝑐2 𝑒 −1− 2 𝑡
Using the initial condition
0 = 𝑐1 𝑒 0 + 𝑐2 𝑒 0
−1 = −1 + 2 𝑐1 𝑒 0 + −1 − 2 𝑐2 𝑒 0
Get
2 −1+ 2 𝑡
2 −1− 2 𝑡
𝑥 𝑡 =− 𝑒 + 𝑒
4 4

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 10


Ordinary Differential Equations

MATLAB Code
t=linspace(0,10,100);
Fun1=@(t,y) [y(2);y(1)-2*y(2)];
[t,y]=ode45(Fun1,t,[0;-1]);
hold on
plot(t,y(:,1))
plot(t,-sqrt(2)/4*exp((-
1+sqrt(2))*t)+sqrt(2)/4*exp((-1-
sqrt(2))*t),'r--')
grid on
xlabel('t(s)');
ylabel('x(t)');

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 11


Ordinary Differential Equations

TRIAL-SOLUTION METHOD (Second order equations)


 When 𝑏 2 − 4𝑎𝑐 < 0, the roots of the auxiliary equation are
complex conjugate

 Using
𝑒 𝑖𝜃 = cos 𝜃 + 𝑖 sin 𝜃
 Get
𝑥 𝑡 = 𝑐1 𝑒 𝛼𝑡 cos 𝛽𝑡 + 𝑖 sin 𝛽𝑡 + 𝑐2 𝑒 𝛼𝑡 (cos 𝛽𝑡 − 𝑖 sin 𝛽𝑡)

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 12


Ordinary Differential Equations

 Solve the initial value problem


𝑦 + 2𝑦 + 2𝑦 = 0; 𝑦 0 = 0, 𝑦 0 =2

𝑦 𝑡 = 2𝑒 −𝑡 sin 𝑡

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 13


Ordinary Differential Equations

MATLAB Code
t=linspace(0,10,100);
Fun1=@(t,y) [y(2);-2*y(1)-
2*y(2)];
[t,y]=ode45(Fun1,t,[0;2]);
hold on
plot(t,y(:,1))
plot(t,2*exp(-t).*sin(t),'r--')
grid on
xlabel('t(s)');
ylabel('x(t)');

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 14


Laplace Transform Review

 The Laplace transform is defined as

 The Laplace transform provides a systematic and general method


for solving linear ODEs, and is especially useful either for
nonhomogeneous.
 It converts linear differential equations into algebraic relations
that can be handled easily.

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 15


Laplace Transform Review

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 16


Laplace Transform Review

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 17


Laplace Transform Review

 Find the Laplace transform, 𝑌 𝑠 to the following differential


equation,
𝑑2 𝑦 𝑑𝑦
2
+ 12 + 32𝑦 = 32𝑢 𝑡
𝑑𝑡 𝑑𝑡
 Assuming that all initial conditions are zero and 𝑢 𝑡 = 1
2
32
𝑠 𝑌 𝑠 + 12𝑠𝑌 𝑠 + 32𝑌 𝑠 =
𝑠
32 32
𝑌 𝑠 = 2
=
𝑠 𝑠 + 12𝑠 + 32 𝑠 𝑠+4 𝑠+8

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 18


Partial-Fraction Expansion

Case 1. Roots of the Denominator of 𝑭(𝒔) Are Real and Distinct


2
𝐹 𝑠 =
(𝑠 + 1)(𝑠 + 2)
Solution
2 𝑘1 𝑘2
= +
(𝑠 + 1)(𝑠 + 2) 𝑠 + 1 𝑠 + 2
 Let Multiply by (𝑠 + 1) and set 𝑠 = −1
2
= 𝑘1 → 𝑘1 = 2
(−1 + 2)
 Multiply by (𝑠 + 2) and set 𝑠 = −2
2
= 𝑘2 → 𝑘2 = −2
(−2 + 1)
 𝑓(𝑡) is the sum of the inverse Laplace transform of each term, or
𝑦 𝑡 = 2𝑒 −𝑡 − 2𝑒 −2𝑡
MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 19
Partial-Fraction Expansion

Case 2. Roots of the Denominator of 𝑭(𝒔) Are Real and Repeated


2
𝐹 𝑠 =
𝑠+1 𝑠+2 2
Solution
2 𝑘1 𝑘2 𝑘3
2
= + 2
+
𝑠+1 𝑠+2 𝑠+1 𝑠+2 𝑠+2
 Let Multiply by (𝑠 + 1) and set 𝑠 = −1
2 2
𝑘1
= 𝑠+2 + 𝑘2 + 𝑠 + 2 𝑘3
𝑠+1 (𝑠 + 1)
2
2
= 𝑘1 → 𝑘1 = 2
−1 + 2
 Let Multiply by 𝑠 + 2 2 and set 𝑠 = −2
2
= 𝑘2 → 𝑘2 = −2
(−2 + 1)

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 20


Partial-Fraction Expansion

Case 2. Roots of the Denominator of 𝑭(𝒔) Are Real and


Repeated
2
𝐹 𝑠 =
𝑠+1 𝑠+2 2
Solution
 To find 𝐾3 , we differentiate
2 2
𝑘1
= 𝑠+2 + 𝑘2 + 𝑠 + 2 𝑘3
𝑠+1 (𝑠 + 1)
with respect to s,
−2 𝑠+2 𝑠
2
= 2
𝑘1 + 𝑘3
𝑠+1 𝑠+1
Let 𝑠 = −2 get 𝑘3 = −2
 𝑓(𝑡) is the sum of the inverse Laplace transform of each term, or
𝑦 𝑡 = 2𝑒 −𝑡 − 2𝑡𝑒 −2𝑡 − 2𝑒 −2𝑡
MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 21
Partial-Fraction Expansion

Case 3. Roots of the Denominator of 𝑭(𝒔) Are Complex or


Imaginary
3
𝐹 𝑠 =
𝑠 𝑠 2 + 2𝑠 + 5
Solution
 This function can be expanded in the following form:
3 𝑘1 𝑘2 𝑠 + 𝑘3
2
= + 2
𝑠 𝑠 + 2𝑠 + 5 𝑠 𝑠 + 2𝑠 + 5
3
 𝐾1 is found in the usual way to be 𝐾2 and 𝐾3 can be found by
.
5
first multiplying by the lowest common denominator 𝑠(𝑠 2 +

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 22


Partial-Fraction Expansion

Case 3. Roots of the Denominator of 𝑭(𝒔) Are Complex or Imaginary


3 2 6
3 = 𝑘2 + 𝑠 + 𝑘3 + 𝑠+3
5 5
3 6
 Balancing coefficients, 𝑘2 + = 0 and 𝑘3 + = 0
5 5
3 6
𝑘2 = − , 𝑘3 = −
5 5
 𝑓(𝑡) is the sum of the inverse Laplace transform of each term, or
3 3 5 3 𝑠+2
2
= −
𝑠 𝑠 + 2𝑠 + 5 𝑠 5 𝑠 2 + 2𝑠 + 5
3 5 3𝑠 + 1 + 1 2 2
= −
𝑠 5 𝑠 + 1 2 + 22
 𝑓(𝑡) is the sum of the inverse Laplace transform of each term, or
3 3 −𝑡 1
𝑓 𝑡 = − 𝑒 cos 2𝑡 + sin 2𝑡
5 5 2
MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 23
Questions

MCT 456 Dynamic Modeling and Simulation Dr. Ahmed Asker 24

You might also like