Laplace Matlab
Laplace Matlab
TABLE 4.2
Transform Pairs
Signal/System—f(t) Transform—F(s)
δ(t) 1
u(t) 1/s
tu(t) 1/s2
tnu(t) n!/sn+1
e−atu(t) 1/(s + a)
te−atu(t) 1/(s + a)2
cos(ωat)u(t) s/(s + ω20)
sin(ωat)u(t) ω0/(s2 – ω20)
e−at cos(ωat)u(t) (s + a)/( (s + a)2 + ω20 )
e−at sin(ωat)u(t) (s + ω0)/( (s + a)2 + ω20 )
cosh(ω0t)u(t) s/(s2 − ω20)
sinh(ω0t)u(t) ω0/(s2 + ω20)
1 1
t n − 1 e at u(t)
(n − 1)! ( s − a )n
1 1
(e at − e bt )u(t)
a−b ( s − a) ( s − b )
−a
(1 − e at)u(t) s ( s − a)
w0 2
[1 − cos (w0t)]u(t) s (s2 + a 2 )
s sin() + w0 cos()
[sin (w0t + θ)]u(t) s 2 + w0 2
s cos() − w0 sin()
[cos (w0t + θ)]u(t) s 2 + w0 2
R.4.82 The most important time (t)–frequency (s) properties and relations of the unilateral
LT are given as follows (similar to the FT properties):
a. Linearity
Let
£[ f1(t)] F1(s) and £[ f 2 (t)] F2 (s)
then
a1 f1(t) a2 f 2 (t) ←
→ a1F1(s) a2 F2 (s)
b. Time scaling
1 s
f ( at) ↔
a a
F
c. Time shifting
f (t t0 ) ↔ F(s)est0
d. s-Shifting
f (t)e s0t ↔ F(s s0 )
e. Differentiation in freq(s)
dF(s)
t ⋅ f (t) ↔
ds
f. Differentiation in t
df (t)
↔ sF(s) f (0 )
dt
d df (t) d2
2 [ f (t)] ↔ s[sF(s) f (0 )] f
(0 )
dt dt dt
s2 F(s) sf (0 ) f
(0 )
∫ 0 est f (t)dt
T
f (t) ↔
(1 esT )
i. Integration in t
1 f (0 )
∫ f (
)d
↔ s F(s) s
0
j. Convolution in t or product in s
∞
f1(t) ⊗ f 2 (t) ∫ f1(
) f 2 (t
)d
↔ [F1(s)F2 (s)]
∞
k. Product in t or convolution in s
1
f1(t) f 2 (t) ↔ [F1(s) ⊗ F2 (s)]
2j
R.4.83 The initial value (t = 0) and the final value (t = ∞) of a given function f(t) can be
evaluated from its LT F(s), by the relations stated as follows, known as the initial
and final value theorems, respectively.
a. The initial value theorem is given by
(test that all the poles of sF(s) are real and negative)
b. The final value theorem states that
(test if all the poles are on the left half of the s-plane)
R.4.84 The initial and final value theorems permit to calculate f(0+) and f(∞), if one exists,
directly from the transform F(s), without the need of inverting the transform.
R.4.85 For example, the initial and final value for the case of f(t) = u(t) are evaluated as
follows (recall that £[u(t)] = 1/s), then
a. u(t = 0+) = limit s→ [sF(s)] limit s→ [s(1s)] 1
b. u(t = ∞) = limit s→ 0 [sF(s)] limit s→ 0 [s(1s)] 1
The results just obtained confirm what is already known, that is, u(t = 0+) =
u(t = ∞) = 1.
R.4.86 The final value theorem evaluates f(∞), if all the singularities are in the left half of
the s-plane. A simple pole (of F(s)) at the origin is permitted, but all the remaining
poles must be in the left half of the s-plane, and the degree of the denominator must
be greater or equal to the degree of the numerator of F(s). If any of the preceding
conditions are not met, f(t) becomes unbounded as t approaches infinity, or physi-
cally f(t) would sustain nondecaying oscillations.
R.4.87 The transfer function, or system function, is the equation that defines the dynamic
properties of a linear system given by
where H(s) is in general a rational function, given as the ratio of two polynomials
Y(s) (its output) and X(s) (its system input).
R.4.88 Recall from previous chapters that the values of s that make H(s) go to zero and
infinity are called the system zeros and poles, respectively. Hence the transfer func-
tion can be completely defined in terms of its poles, zeros, and a constant multiplier
referred to as gain.
R.4.89 The LT of any function, including H(s) must be accompanied by its ROC; only
then the corresponding time function h(t) is unique. If H(s) is a one-sided trans-
form then the ROC is not needed, and defi nes a unique inverse.
For obvious reasons, the ROC must exclude the system’s poles.
R.4.90 A causal system can be defined in the frequency domain as the one with the ROC
located to the right of the pole having the largest real part.
R.4.91 Similarly, a noncausal system can be defined as the one with the ROC located to the
left of the pole having the smallest real part.
R.4.92 Mix systems are the ones that have poles in the left-half plane (causal), as well as,
poles in the right-half plane (noncausal). The ROC then lies between the pole hav-
ing the smallest real part, of the causal subsystem, and the pole having the smallest
real part of the noncausal subsystem.
R.4.93 The stability of a system is given by the location of its system’s poles. Stable causal
systems must have all the poles to the left of the imaginary axis, and the axis itself
may be considered part of the ROC.
R.4.94 The MATLAB function pzmap (Y, X) returns the plot of the poles and zeros specified
by the coefficients of the polynomials of Y and X, the numerator and denominator
of H(s), expressed as vectors arranged in descending powers of s. It is customary to
indicate the location of the system’s poles by xs, and the system’s zeros by os, on the
s-plane (complex plane).
The command pzmap uses those characters and returns the pole and zero
constellation.
R.4.95 For example, create the script file map_pz that returns the constellation plot of the
poles and zeros of the transfer function H(s) given by
5s2 5s 30
H (s)
s 3s2 4s 2
3
their respective values (poles and zeros), and indicate the ROC (Figure 4.8).
MATLAB Solution
% Script file: map _ pz
num = [5 5 -30];
den = [1 3 4 2];
pzmap(num,den);
disp(‘***************************************************************’)
disp(‘The zeroes and poles of H(s) are:’)
disp(‘***************************************************************’)
zeroes = roots(num)
poles = roots(den)
real _ s = min(real(poles));
disp(‘***************************************************************’)
disp(‘The ROC lie in the region given by : real part greater than ‘)
roc
disp(‘***************************************************************’)
The script file map_pz is executed and the results are indicated as follows:
>> map _ pz
*************************************************
The zeroes and poles of H(s) are:
*************************************************
zeroes =
-3
2
poles =
-1.0000 + 1.0000i
-1.0000 - 1.0000i
-1.0000
**************************************************
The ROC lie in the region given by: real part greater than
real _ s =
-1.0000
**************************************************
Pole−zero map
1.5
1
Region of convergence
0.5
Imaginary axis
−0.5
−1
−1.5
−3 −2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2
Real axis
FIGURE 4.8
Pole/zero plot of R.4.95.
R.4.96 Recall that the linear time invariant (LTI) system transfer function H(s) is a rational
function, given as the ratio of two polynomials in s. These rational functions can be
expressed in terms of a partial fraction expansion, a format that can be used in the
evaluation of the ILT, by using the transformation Table 4.2.
Recall from Chapter 7 of the book entitled Practical MATLAB® Basics for Engi-
neers, that the MATLAB function [r, p, k] = residue(num, den) returns the coefficients
(residues) r, the poles p, and the stand-alone term k of the partial fraction expansion
given by the ratio of the num(Y) and den(X) polynomials expressed as vectors con-
sisting of its coefficients arranged in descending powers of s.
Recall also that the poles can be distinct real, repeated, and complex, where com-
plex poles always occur as conjugate pairs. In the evaluation process of the LT of a
real function of t, distinct real poles are rather easy to deal with (see Chapter 7 of
the book entitled Practical MATLAB® Basics for Engineers).
When repeated poles are present in the form (s + a)n, the partial fraction expan-
sion must include the following terms: b1/(s + a), b2 /(s + a)2, …, bn/(s + a)n.
R.4.97 For example, let
5s 4 7 s2 3s2 5s 30
H (s)
s 4 4s3 7 s2 6s 2
MATLAB Solution
>> num = [5 7 3 5 -30];
>> den = [1 4 7 6 2];
>> [r,p,k] = residue(num,den)
r = % PFE coefficients
-6.5000 -20.5000I
-6.5000 +20.5000i
0.0000
-34.0000
p = % poles
-1.0000 + 1.0000i
-1.0000 - 1.0000i
-1.0000
-1.0000
The partial fraction coefficients given by the column vector r are then matched
with the corresponding poles given by the column vector p, obtaining the follow-
ing expansion:
Observe that H(s) has repeated poles at s = −1, then the PFE consists of two terms,
a linear and a quadratic as a consequence of the repeated pole, as well as, two other
terms as a consequence of the pair of complex poles, and the stand-alone term k.
R.4.98 Four examples of the evaluations of the direct and inverse LTs by hand calcula-
tions, using Table 4.2, are provided as follows, to gain practice and insight into the
process.
a. Example (#1)
Let
Find F(s).
ANALYTICAL Solution
then
5 2 10(3) 5(s + 2)
F(s)
s s + 3 s2 + 3 2 (s + 2)2 + 7 2
b. Example (#2)
Let
10 20 30
F(s) 2
s s s3
Find f(t).
ANALYTICAL Solution
c. Example (#3)
Let
8s 30
F(s)
s2 25
Find f(t).
ANALYTICAL Solution
8s 5
F(s) 6 2
s2 52 s 52
then
f(t) = £−1[F(s)] = 8 cos(5t) u(t) + 6 sin(5t) u(t)
d. Example (#4)
Let
4s 10
Y(s)
s(s 1)(s 2)
Find y(t).
ANALYTICAL Solution
A B C
Y(s)
s s1 s 2
where y(t) = £−1[Y(s)]. The process of evaluating the coefficients A, B, and C by hand
is illustrated as follows:
( 4s 10) ⋅ (s) 10
A 5
s(s 1)(s 2) s0 (1)(2)
( 4s 10)(s 1)
B 6
s(s 1)(s 2) s1
( 4s 10)(s 2)
C 1
s(s 1)(s 2) s2
then
5 6 1
Y(s)
s s1 s 2
and
R.4.99 Let us use the concepts developed by the Laplace technique, in the analysis of elec-
trical networks. Recall that vR(t) = R i(t) (Ohm’s law), and its Laplace transform is
given by £ [vR(t)] = £[R ⋅ i(t)] = R £[i(t)], then
VR(s) = R * I(s)
Ohm’s law holds in the frequency domain, and the impedance Z(s) (Ω) is defined by
V (s)
Z(s)
I (s)
The time–frequency domain relation for a pure resistor R is illustrated in Figure 4.9.
R R
FIGURE 4.9
Time–frequency domain relation for R.
R.4.100 The voltage across a capacitor C, denoted by vC(t) is expressed in the time domain
and its equivalent in the frequency domain as follows by (using FT properties):
t
1 I (s) VC (0)
vC (t) ∫
C ∞
ic (
)d
↔ Vc (s)
sC
s
I (s) 5
VC (s)
2s s
I(s)
R.4.102 Note that if VC(s) = ___, then the impedance of the capacitor C in the frequency
sC
domain is given by
1
XC ( s )
sC
R.4.103 The equivalent circuit models of a capacitor in the time and frequency domain are
shown in Figure 4.10 using either a voltage source in series with the impedance
XC(s) = 1/(sC), or by source transformation, a current source in parallel with XC(s),
assuming that its initial voltage is vC(0) = V0 V.
R.4.104 The voltage across an inductor L, denoted by vL(t), is expressed as follows in the
time and frequency domain by
di(t)
vL (t) L ←
→ VL (s) sLI (s) LI 0
dt
1/ (sC)
+
V0 V C 1/ (sC)
C V0
− V0 /s
FIGURE 4.10
Time–frequency domain relation for C.
sL
I0 I0 /s (amp)
L sL
LI0
(volts)
FIGURE 4.11
Time–frequency domain relation for L.
e(t ) = V0
E(s) = V0 /s
(volts)
(volts)
V0w 0
E(s) = (volts)
+ + s 2 + w02
e(t) = V0 sin(w 0t)
− (volts) −
FIGURE 4.12
Time–frequency domain relation for DC and AC voltage sources.
i(t ) = I0
(amp) I(s) = I0 /s (amp)
i(t ) = I 0 cos(w0t)
I0 s
(amp) i(t ) = (amp)
s 2 + w02
FIGURE 4.13
Time–frequency domain relation for DC and AC current sources.
sw closes at t = 0
sw closes at t = 0
I(s)
i(t ) V/s
v C Vr (s) = I(s)R
C R
I (s) V0
Vc (s) = +
Vc(0) = V0 sC s
Note that these type of problems referred as transients were presented, discussed,
and solved in Chapter 2, using DEs (time domain).
ANALYTICAL Solution
The first step in the solution process is to redraw the circuit diagram shown in
Figure 4.14 in the frequency domain (using the LTs) illustrated in Figure 4.15.
Observe that the voltage source V in the time domain is transformed to V/s in the
frequency domain, due to the step characteristics of the switch (sw). Its transform is
given by Vu(t) → V/s. Also observe that the initial voltage of the capacitor also acts as
a step function in time, therefore, its transform is given by
V0
V0u(t ) →
s
Then, applying Kirchhoff’s voltage law to the loop of the circuit diagram, shown in
Figure 4.15, and performing some algebraic manipulation the current I(s) can be solved,
and an expression for i(t) (ILT) can be obtained, as indicated in the following:
V I (s) V0
RI (s)
s sC s
I (s) V V0
I (s)R
sC s s
1 V V0
I (s) R
sC s
V V0 1
I (s) ⋅
R s (1RC )
V V0 t RC
i(t) £1 [ I (s)] e u(t)
R
R.4.110 Now consider the simple RL circuit shown in Figure 4.16, and let us solve for i(t),
assuming that the initial inductor’s current is IL(0) = I0 = 10 (amp), in a counter-
clockwise direction.
ANALYTICAL Solution
The time domain circuit diagram of Figure 4.16 is transformed using the LT into the
frequency domain circuit diagram shown in Figure 4.17.
Then the analytical solution leading to i(t) is obtained by the following steps:
a. Write the resulting equation by applying Kirchhoff’s voltage law around the
loop of the circuit shown in Figure 4.17
b. Solve for I(s) (using partial fractions expansion if necessary)
c. Obtain i(t) by taking the ILT of I(s)
sw closes at t = 0
sw closes at t = 0
I(s)
i(t) V/s
V I0 Vr = I(s)R
R
FIGURE 4.17
FIGURE 4.16 Frequency domain representation of the
Network of R.4.110. network of Figure 4.16.
V
RI (s) LsI (s) LI 0
s
V
I (s) [R Ls] LI 0
s
V 1 1
I (s) LI 0
s R Ls R Ls
V 1 1
I (s) s(s RL) I 0 s R L
L
A B I0
I (s)
s s R L s R L
Solving for the constants A and B, and substituting in I(s), the following expression
is obtained:
V R V R I0
I (s)
s s R L s R L
Finally, transforming I(s) from the frequency domain back to the time domain, the
following solution for i(t) is obtained:
V
i(t) £1[I (s)] (1 e Rt L ) u(t) I 0 eRt L u(t)
R
R.4.111 As mentioned earlier, one of the most powerful applications of the LT is the solu-
tion of integrodifferential equations illustrated by the transient analysis of RC and
RL circuits of R.4.109 and R.4.110. These concepts are extended to include loop or
node equations.
The steps involved are summarized as follows:
a. Write the integrodifferential set of equations (loop or node equations) for a
given circuit.
b. Transform the integrodifferential equations of part a using Laplace into an alge-
braic set of equations, in which the initial conditions are automatically inserted.
c. The algebraic set of equations of part b are then solved for either the currents
{I(s)} (loop equations) or voltages {V(s)} (node equations).
d. Finally, the time solution is obtained by taking the ILT of the expressions obt-
ained in part c.
R.4.112 The example shown in the circuit diagram of Figure 4.18, is solved for the current
i(t), is used to illustrate the steps followed in the solution of an integrodifferential
system, in which each step is labeled according to R.4.111.
ANALYTICAL Solution
Step a
+
V(t ) = 60 e − t
−
R=6Ω R=6Ω
FIGURE 4.18
Network of R.4.112.
di(t)
60et u(t) 2 6i(t)
dt
Step b
60
2sI (s) 6I (s) (Taking the LT )
s1
60
I (s)[2s 6]
s1
Step c
60 60
I (s)
(s 1)(2s 6) 2(s 1)(s 3)
30 A B
I (s) ( by partial fractions expansion))
(s 1)(s 3) s 1 s 3
30 30
A 15
s 3 s1 2
30 30
A 15
s 1 s3 2
then
15 15
I (s) taking the ILT
s1 s 3
Step d
R.4.113 To gain additional experience, five examples of DEs are presented and solved
manually, using the LT technique.
The following examples are solved for y(t) for each of the given DEs.
a. Example (#1)
Given the DE
dy(t)
2 4 y(t) 0 with IC (initial condition) y(0) 20
dt
ANALYTICAL Solution
4Y(s)
sY(s) 20 2Y(s)
2
then
sY(s) 2Y(s) 20 0
Y(s)(s 2) 20 0
then
20
Y(s)
s2
b. Example (#2)
d 2 y(t)
Let the initial value of DE be 4 y(t)
dt 2
with the IC given by
dy(t)
y(0) 0 and t0 8
dt
ANALYTICAL Solution
dy(t)
s2Y(s) sy(0) 4Y(s)
dt t0
Y(s)[s2 4] 8
8 2
Y(s) 4 2
s2 4 s 22
y(t) £1[Y(s)]
y(t) 4 sinh(2t)u(t)
c. Example (#3)
Let
d 2 y(t)
9 y(t)
dt 2
ANALYTICAL Solution
dy(t)
s2Y(s) sy(0) 9Y(s)
dt t0
Y(s)(s2 9) 15
15 3
Y(s) 5 2
s2 9 s 3 2
then
y(t) £1[Y(s)]
y(t) 5 sin(3t)u(t)
d. Example (#4)
Let
dy(t)
2 3 y(t) 30
dt
ANALYTICAL Solution
30
Y(s)[2s 3]
s
then
30
Y(s)(2s 3)
s
30 15 A B
Y(s)
s(2s 3) s(s 1.5) s s 1.5
10 10
Y(s)
s s 1.5
then
y(t) £1[Y(s)]
and
y(t) 10 u(t) 10e1.5t u(t)
e. Example (#5)
Let
dy(t)
4 y(t) 0
dt
with y(0) = 10.
ANALYTICAL Solution
sY(s) 10 4Y(s) 0
10
Y(s)(s 4) 10, Y(s)
s4
and
y(t) £1[Y(s)]
then
y(t) 10e4t u(t)
R.4.114 The MATLAB function F = laplace(f) returns the LT of ƒ, denoted by f(t) → F(s),
where f is a symbolic object with independent variable t.
R.4.115 The following examples illustrate the procedure used to obtain the LT of the stan-
dard time functions (signals or systems) using the symbolic MATLAB toolbox.
Obtain the LT of the following time-dependent functions, and compare the
results with the transforms of Table 4.2.
a. f1(t) = exp(t)
b. f2(t) = t exp(t)
c. f3(t) = cos(t)
d. f4(t) = sin(t)
e. f5(t) = t7
f. f6(t) = u(t)
g. f7(t) = pul(t/2)
MATLAB Solution
>> syms s t x ;
>> F1 = laplace(exp(t)) % part (a)
F1 =
1/(s-1)
>> F7 = laplace(sym(‘Heaviside(t+1)’)
-sym(‘Heaviside(t-1)’)) % part(g)
F7 =
1/s-exp(-s)/s
Note that the transforms obtained using the symbolic MATLAB toolbox fully
agree with the transforms of Table 4.2.
R.4.116 The MATLAB function f = ilaplace(F), where F is a symbolic expression with inde-
pendent variable s, returns the ILT of F, denoted by f which is a function of t,
denoted by F(s) → f(t).
R.4.117 For example, using the symbolic MATLAB toolbox obtain the ILT of the following
frequency-dependent functions (F1 through F7 of R.4.115):
a. F1 = 1/(s − 1)
b. F2 = 1/(s − 1)2
c. F3 = s/(s2 + 1)
d. F4 = 1/(s2 + 1)
e. F5 = 5040/s8
f. F6 = 1/s
g. F7 = (1/s) −e−s/s
MATLAB Solution
>> syms s t
>> F1=1/(s-1)
>> f1 = ilaplace(F1)
f1 =
exp(t)
>> F2 = 1/(s-1)^2;
>> f2 = ilaplace(F2)
f2 =
t*exp(t)
>> F3 = s /(s^2+1);
>> f3 = ilaplace(F3)
f3 =
cos(t)
>> F4 =1/(s^2+1);
>> f4 = ilaplace(F4)
f4 =
sin(t)
>> F5 = 5040/s^8;
>> f5 = ilaplace(F5)
f5 =
t^7
>> F6 = 1/s;
>> f6 = ilaplace(F6)
f6 =
1
>> F7 = 1/s-e-s/s;
>> f7 = ilaplace(F7)
f7 =
1-Heaviside(t-1)
R.4.118 Let us now illustrate the power of MATLAB by solving again the four Example
problems of R.4.98, using MATLAB, given below by the script file solve_DE.
Recall that the examples of R.4.98 were solved by hand. Compare the results, as
well as the labor involved in each process.
MATLAB Solution
% Script file: solve _ DE
syms s t ft Fsa ftb Fsb ftc Fsc yt Y
disp(‘*******************************’)
disp(‘****Solutions using Matlab****’)
disp(‘*******************************’)
disp(‘(a) Example(#1), the time function f(t) is:’)
ft = 5+2*exp(-3*t)+10*sin(3*t)+5*exp(-2*t)*cos(7*t);
pretty(ft)
disp (‘its Laplace transform F(s) is given by:’)
Fsa = laplace(ft);
pretty(Fsa)
disp(‘*******************************’)
disp(‘(b) Example(#2), the frequency function F(s) is:’)
Fsb = 10/s+20/s^2+30/(s+3);
pretty(Fsb)
disp(‘its inverse Laplace transform is, f(t):’)
ftb=ilaplace(Fsb);
pretty(ftb)
disp(‘*******************************’)
disp(‘(c)Example(#3), the frequency function F(s) is:’)
Fsc = (8*s+30)/(s^2+25);
pretty(Fsc)
disp(‘its inverse Laplace transform, f(t) is:’)
ftc = ilaplace(Fsc);
pretty(ftc)
disp(‘*******************************’)
disp(‘(d) Example(#4), the frequency function Y(s) is:’)
Y = (4*s+10)/(s*(s+1)*(s+2));
pretty(Y)
disp(‘its inverse Laplace transform, y(t) is given by:’)
yt = ilaplace(Y);
pretty(yt)
disp(‘*******************************’)
The script file solve_DE is executed and the results are as follows:
>> solve _ DE
**************************************
****** Solutions using Matlab ******
**************************************
(a) Example(#1), the time function f(t) is:
5 + 2 exp(-3 t) + 10 sin(3 t) + 5 exp(-2 t) cos(7 t)
its Laplace transform F(s) is given by :
2 30 s + 2
5/s + ----- + ------ + 5 -------------
s + 3 2 2
s + 9 (s + 2) + 49
************************************
(b) Example(#2), the frequency function F(s) is:
10 20 30
---- + ---- + -----
s 2s s + 3
its inverse Laplace transform is, f(t):
10 + 20 t + 30 exp(-3 t)
************************************
Observe that this frequency–time relation pair was presented in R.4.82 (#h), using a
slightly different notation. It is important to understand that the LT can be equally
useful in the analysis of periodic, as well as nonperiodic functions, as was the case
of the FT.
R.4.120 A way to evaluate the ILT of a given transfer function H(s) = num/den is by evaluat-
ing its impulse response h(t). Recall that the MATLAB function impulse (num,den,t)
returns the system impulse response, where num and den are the numerator and
denominator polynomials of H(s) entered as row vectors arranged in descending
powers of s, and t defines the time range of interest.
R.4.121 For example,
3s 25 num(s)
Let F(s)
s2 3s 2 den(s)
then the program that returns the expression for f(t) (f(t) → F(s)), and the plot f(t)
versus t, evaluated by numerical and symbolic techniques, as well as the plot F(s)
versus s, over the ranges: 0 ≤ t ≤ 10, and 0 ≤ s ≤ 10, is given as follows by the
script file F_f.
MATLAB Solution
% Script file: F _ f
num = [0 3 25];
den = [1 3 2];
t = 0:.1:10;
f = impulse (num, den, t);
subplot(3,1,1)