Lab 3 Laplace Transform_v3 (1)
Transcript of Lab 3 Laplace Transform_v3 (1)
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
1/25
ME 413: System Dynamics & ControlME 413: System Dynamics & ControlME 413: System Dynamics & ControlME 413: System Dynamics & Control
LAPLACLAPLACLAPLACLAPLACE TRANSFORME TRANSFORME TRANSFORME TRANSFORM
__________________________________
__________________________________
__________________________________
__________________________________
__________________________________
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
2/25
LAPLACE TRANSFORM
OBJECTIVES
1. To use MATLAB in solving problems of Laplace Transform.2. To solve Initial Value Problem (IVP).3. To use symbolic MATLAB in solving problems of Laplace Transform.
WHY USE LAPLACE TRANSFORM?
Laplace transform is a powerful tool formulated to solve a wide variety ofInitial-Value Problems (IVP) . The strategy is to transform the difficultdifferential equations into simple algebraic problems where solutions can be easilyobtained. One then applies the Inverse Laplace transform to retrieve thesolutions of the original problems. This can be illustrated as follows:
1−L
L
Figure 1 Steps involved in solving Initial Value Problem (IVP) using LaplaceTransform
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
3/25
PART 1: SOLVED PROBLEMS
■ Example 1: Distinct Real PolesFind the inverse Laplace transform of
3 2
num 5( )
den 6 11 6
sG s
s s s
+= =
+ + + (1)
■ Solution:In Eq. (1) num and den denotes respectively, the numerator and denominator of
( )G s .
Zeros: values of s for which ( ) 0G s = . For instance, ( ) 0G s = ⇒ num 5 0s= + = ⇒ 5s = − . Therefore 5s = − is the zero of ( )G s .
Poles: values of s for which ( )G s is undefined (the denominator of( ) 0G s = or 3 2den 6 11 6 0s s s= + + + = ). The roots of the denominator
can be found by MATLAB.
>> den=[1 6 11 6];
>> roots(den)
ans= -3.000-2.000-1.000 }
The above poles are real and distinct , therefore ( )G s can be written in the form
( )( )( ) ( ) ( ) ( )num 5
( )den 3 2 1 3 2 1
+= = = + +
+ + + + + +s A B C G s
s s s s s s (2)
where the residues A , B and C can be determined by any of the followingmethods:
Method 1: Direct calculations of the residues
( )( )( )( )( )123
53
+++++=
sssss
A ( )
( )( )( )
( )( )1
212
132353
=−−
=+−+−
+−=3−=s
( )( )
( )( )( )12352
+++
++=sss
ss B
( )
( )( )
( )
( )( )3
11
3
1232
52−=
−=
+−+−
+−=2−=s
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
4/25
( )( )( )( )( )123
51
+++++=
sssss
C ( )
( )( )( )
( )( )2
124
213151
==+−+−
+−=1−=s
Substituting A , B and C into Eq. (2) gives
(((( )))) (((( )))) (((( ))))12
23
31
)(++++
++++++++
−−−−++++
==== s s s
sG (3)
Therefore, the expression of ( )g t is given by
( ) =g t 1−L ( ) 3 23 2t t t G s e e e− − −= − + (4)
Method 2: Use of MATLAB residue function
The use of MATLAB makes it easier to calculate the residues A , B and C . Equation(1) can be written in the form
( ) =g t 1−L [ ] 31 2
1 2 3
( ) ( )= + + +− − −
r r r G s k s s p s p s p
(5)
where ,i ir p and ( )k s are the residues, poles and direct terms of the partial fraction
expansion of two polynomials ( )num s and ( )den s . Notice that ,i ir p and ( )k s can be found by using the MATLAB command [r,p,k] = residue(num,den) asshown below
>> num=[1 5];>> den=[1 6 11 6];>> [r,p,k] = residue(num,den)
r = 1.0000-3.00002.0000
p = -3.0000-2.0000-1.0000
k = [ ]
Notice that k = [ ] means that ( )k s does not exist. Substituting the above values of
ir , i p and ( )k s into Eq. (5) gives
1 3 2( )
3 2 1= − +
+ + +G s
s s s
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
5/25
which is similar to Eq. (3).
Method 3: Use of symbolic MATLAB toolbox
In order to run the symbolic MATLAB toolbox, one needs to generate the syms function. syms x creates the symbolic variable with name 'x'.
>> syms t s % creates the symbolic variables t and s. >> G = (s+5)/(s^3+6*s^2+11*s+6)>> g =ilaplace (g)
g = exp(-3*t)-3*exp(-2*t)+2*exp(-t)
The above expression can be written in an elegant form by using the function pretty as shown below
>> pretty(g)
exp(-3 t) - 3 exp(-2 t) + 2 exp(-t)
which is similar the solution obtained by the previous methods.
■ Example 2: Repeated Real Poles
Find the inverse Laplace transform of
( )22num 1
( )den 2
= =+
G s s s
(1)
■ Solution:Zeros: NonePoles: 2 0, 0 00s s s⇒ = ⇒ == is a pole of multiplicity 2
( )2
2, 2 22 0 s ss ⇒ = − − ⇒ = −+ = is a pole of multiplicity 2
Unlike the previous case, for repeated poles the expression of ( )G s can be written inpartial fraction form as
( ) ( ) ( )21 1 2
2 222
num 1( )
den 22 2= = = + + +
++ +
AA B B G s s s s s s s
(2)
where the residues i A and i B . can be determined by any of the following methods:
Method 1: Direct Calculation of the Residues
G
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
6/25
2
2 = s A2s ( ) ( )22
0
1 1
40 22=
= =++
s s
2
1d
d= s A
s 2s ( ) ( )( ) ( )
( )
( )
2
2 42
0 00
2
2
0 2 2 2d 1 1d 42 22
2
= ==
× + − + − = = = + ++
+=
s s s
s s s s s s
s B
( )22 2+s s ( )
( )
2
2
2
2
1 1
42
2d
d
=−
= =−
+=
s
s B
s ( )22 2+s s ( )
2
22 22
22
d 1 0 2 1
d 4=−=−=−
× − = = = s s s
s s s s s
Substituting the values of i A and i B into Eq. (2) gives
( ) ( ) ( )2 222num 1 1/ 4 1/ 4 1/ 4 1/ 4
( )den 22 2
−= = = + + +
++ +G s
s s s s s s (3)
The expression of )( t g is given by
( ) 2 21 1 1 14 4 4 4
− −= − + + +t t g t t e te (4)
Method 2: Use of MATLAB residue function
For repeated poles, the residues i A and i B may be calculated, using the followingMATLAB command
resi2(num,den,pole,n,k) returns the residue of a repeated pole of order n andthe kth power denominator of [1-pole], where numand den represent the original polynomial rationum/den.
This can be illustrated as
>> num = [1];>> a = conv([1 0], [1 0]); % the expression of s 2 >> b = conv([1 2], [1 2]); % the expression of (s+2) 2 >> den = conv(a, b); % the expression of s 2 (s+2) 2 %>> A1 = resi2(num,den,0,2,1) gives ,2500.01 −−−−==== A >> A2 = resi2(num,den,0,2,2) gives ,2500.02 ==== A >> B1 = resi2(num,den,-2,2,1) gives ,2500.01 ==== B >> B2 = resi2(num,den,-2,2,2) gives ,2500.0
2 ==== B
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
7/25
Substituting the above values into Eq. (2), one can get
(((( )))) (((( )))) (((( ))))2222
2
4 / 1
2
4 / 14 / 14 / 1
2
1
den
num)(
++++
++++
++++
++++++++−−−−====
++++
======== s s s s s s
sG
which is similar to Eq. (3).
Remark : For repeated poles, the command [r,p,k] = residue(num,den) can beapplied and provides the same residues and poles. However, it does notarrange them in the appropriate order and this may confuse the student.
Method 3: Use of Symbolic MATLAB Toolbox
>> syms t s>> G = 1 /((s^2)*(s+2)^2)>> g=ilaplace (G)
g = exp(-t)*(1/2*t*cosh(t)-1/2*sinh(t))
knowing that
sinh( )2
−
= −t t
t e e and cosh( )2
−
= +t t
t e e
the above expression of g can be written as
( ) 2 21 1 1 12 2 2 4 4 4 4
− − −− − + −= − = + − −
t t t t t t t e e e e e g t t t te e
which is similar to Eq. (4).
■ Example 3: Complex Conjugate Poles Find the inverse Laplace transform of
222 2)(
ω++++=
aass
C BssG (1)
where a and ω are real positive.
■ Solution:
The expression of ( )G s can be written as
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
8/25
( ) ( )22 2 2 2( )
2
Bs C Bs C G s
s as a s aω ω + +
= =+ + + + +
(2)
It is clear that the denominator is the sum of two complete squares . The roots ofthe denominator (poles) are:
( )2 122
0s a j
s as a j
ω ω
ω = − +
+ + = ⇒ = − +
(3)
where 1−−−−==== j and 1s and 2s are complex conjugates. The location of the poles
1s and 2s is shown in Figure 2.
2s
1s
a−
Figure 2 Complex conjugate roots in the s-plane
Method 1: Completing the Square
The expression of ( )G s can be written in a form that can be easily recognized usingLaplace Transform tables. Therefore, ( )G s is written as
( )( )( )
( )( ) ( )
( )( ) ( )
2 22 2
2 22 2
2 22 2
( )a Ba
a B
B s C Bs C G s
s a s a
B s C s a s a
B
a
s a BC
s s a
a
a
ω ω
ω
ω ω
ω
ω
ω
+ + −+= =
+ + + +
+ −= ++ + + +
+ −= +
+ + + +
(4)
Using entries 20 & 21 of Table 2-1, page 19 Textbook, ( )g t is given by
( ) ( ) ( )( ) cos sinat at C Ba
g t Be t e t ω ω ω
− −−= + (5)
_
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
9/25
Method 2: Partial Fraction Expansion
Since1
s a jω = − + and2
s a jω = − − are the poles of ( )G s , therefore ( )G s can bewritten as
( )( )( )
Bs C G s
s a j s a j s a j s a j
α β ω ω ω ω
+= = +
+ + + − + + + − (6)
where α and β can be determined in a similar manner to that of Example #1.
( )( )
( )( )
( )
( )
( )
ω
−+=
ω−+ω−−
+ω−−=
ω−+ω++
+ω++=α
ω−−=22
BaC j
B
ja ja
C ja B
jas jas
C Bs jas
jas
(7)
and
( )( )( )( )
( )( )
( )ω
−−=
ω++ω+−+ω+−
=ω−+ω++
+ω−+=β
ω+−= 22 BaC
j B
ja jaC ja B
jas jasC Bs jas
jas
(8)
Notice that α and β are complex conjugate. Substituting α and β into Eq. (6)gives
( ) ( )
ω−+ ω
−−
+ω++ ω
−+
= jas
BaC j
B
jas
BaC j
B
sG2222
)( (9)
Taking the inverse Laplace transform of Eq. (9) gives
( ) ( ) ( ) ( )( )2 2 2 2
ω ω
ω ω − − − +− −
= + + −
a j t a j t C Ba C Ba B B g t j e j e
Arranging terms, the above expression can be written in the form
( )( ) 2 2
ω ω ω ω ω
− −− −− = + − −
j t j t j t j t at at C Ba B g t e e e j e e e
Multiplying the second term of the above equation by j and dividing by j , results inthe following expression
( )( )
2 2 2 2
ω ω ω ω
ω
− −− − −+ −= − ×
j t j t j t j t at at C Ba B e e e e g t e j j e
j (10)
Using Eulers’ Formulae
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
10/25
cos , sin2 2
ω ω ω ω ω ω
− −+ −= =
j t j t j t j t e e e e t t j
(11)
the expression of ( )g t is written as:
( )( ) cos sinω ω
ω − −−= +at at
C Ba g t Be t e t (12)
which is similar to equation (5).
■ Example 4: Initial Value Problem (IVP)
Solve the following Initial Value Problem (IVP)
0)0(,0)0(),(23 ===++ y yt f y y y (1)
where ( ) f t is a function given by the graphshown in Fig. 3.
■ Solution: Step 1: The expression of ( ) f t is given by
≥
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
11/25
Therefore,
)1()()( −−= t ut ut f (3)
as shown in figure 4. Laplace transform of the previous expression is given by
( )ss
ess
es
sF −−
−=−= 111
)(
Step 2 : Remember:
Non-zero Initial Conditions Zero Initial Conditions(0) 0, (0) 0 y y= =
L { }
2
( ) (0) (0) y s Y s sy y= − −
L
{ }2
( ) y s Y s= L { } ( ) (0) y sY s y= − L { } ( ) y sY s= L { } ( ) y Y s= L { } ( ) y Y s=
Taking Laplace transform of both sides of equation (1) gives:
( ) ( )2 13 2 ( ) 1 ss s Y s es
−+ + = −
Step 3 : Solve for ( )Y s
( ) ( ) ( )21
( ) 1 ( ) 13 2
s sY s e H s es s s
− −= − = −+ +
where
( )21 1/ 2 1 1/ 2
( )1 2 1 23 2
H ss s s s s ss s s
α β γ = = + + = − +
+ + + ++ +
Hencet t
eet h2
2
1
2
1)(
−−+−=
Therefore, using the first expression
L [ ]( ) ( ) ( )sh t u t e H sα α α −− − = ⇔1−L ( ) ( ) ( )se H s h t u t α α α − = − − , 0α ≥
For this example 1α = and the expression of1−L ( )se H s− is given by
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
12/25
1−L ( 1) 2( 1)
0 0 1( ) ( 1) ( 1) 1 1
12 2
st t
t e H s h t u t
e e t −
− − − −
≤ < = − − = − + >
Step 4 : The solution ( ) y t is therefore given by
( ) y t =1−L [ ]
( 1) 2( 1)
21 2
1 10 1
( ) ( ) ( 1) ( 1) 2 21
t t
t t
e e t Y s f t f t u t
K e K e t
− − − −
− −
− + ≤ <= − − − =
− >
where 11 −= eK and 2 / )1(2
2 −= eK .
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
13/25
PART 2: ASSIGNMENT
■ Problem 1: Real and Distinct Poles
Consider the following transfer function (Instructors are required to fill in theblanks such that the poles are real and distinct)
( )( ) 3 2
num( )
den
s
sG s
ss s s
= +
=+ + +
… …
… … … …
1. With the help of MATLAB, find the poles of ( )G s .2. Write ( )G s in partial fractions
( )( ) 1 2 3
num( )
den
s
sG s
A B C s p s p s p
= = + ++ + +
Where i p are the poles of ( )G s and A , B and C are its residues.3. By hand calculations, find A , B and C .4. Check your finding by using the MATLAB residue command ( See help
residue ) to find A , B and C .
5. Using the results of part (3) above, find ( )g t =1−L [ ]( )G s .
6. Use the symbolic MATLAB command ilaplace ( See help ilaplace ) to
find ( )g t = 1−L [ ]( )G s and compare your finding with (5).
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
14/25
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
15/25
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
16/25
■ Problem 2: Real and Repeated Poles
Consider the following transfer function (Instructors are required to fill in theblanks such that the poles are real and distinct)
( )( ) ( )32
num( )
den
s
sG s
s
s s=
+=
+
… …
…
1. Find the poles and zeros of ( )G s .2. Write ( )G s in partial fractions3. Find the residues of ( )G s by hand calculations.4. Check your finding by using the MATLAB residue command resi2 ( See
help resi2 ) to find the partial fraction expansion of ( )G s .
5. Using the results of part (3) above, find ( )g t =1−
L [ ]( )G s . 6. Use the symbolic MATLAB command ilaplace ( See help ilaplace ), find
( )g t =1−L [ ]( )G s and compare your finding with (5).
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
17/25
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
18/25
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
19/25
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
20/25
■ Problem 3: Complex Conjugate Poles
Consider the following transfer function (Instructors are required to fill in theblanks such that the poles are complex conjugates)
( )( ) 2
num( )
den
s
sG s
ss s
= +=
+ +
… …
… … …
1. Use the method of completing the square to find ( )g t =1−
L [ ]( )G s .
2. Write the partial fraction of ( )G s and then find ( )g t =1−L [ ]( )G s
by using complex algebra.3. Find the residues of ( )G s by hand calculations.4. Use the symbolic MATLAB command ilaplace ( See help ilaplace ), find
( )g t =1−L [ ]( )G s and compare your finding with (2).
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
21/25
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
22/25
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
23/25
■ Problem 4: Final Value Theorem (FVT) and InitialValue Theorem (IVT)
Consider the following transfer function (Instructors are required to fill in theblanks). Use the Initial-Value and Final-Value-Theorems to find ( )0 g and
( ) g ∞ where
( )( )
2
3 2
num( )
den
s
sG s
s ss s s
= + +=
+ + +… … …
… … … …
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
24/25
■ Problem 5: Initial Value Problem (IVP)(Instructors are required to fill in the blanks and to provide the shape
of the graph of ( ) f t ).
Solve the Initial Value Problem (IVP)
( )( ) ( )
,
0 , 0
y y y f t
y y
+ + =
= =
… … …
… …
where ( ) f t is shown in the graph.
0t
( ) f t
-
8/18/2019 Lab 3 Laplace Transform_v3 (1)
25/25