Laplace Transforms Matlab Help

Laplace Transforms

This section explains how to use the Laplace transform with MATLAB to solve some types of differential equations that cannot be solved with dsol ve. Application of the Laplace transform converts a linear differential equation problem into an algebraic problem. With proper algebraic manipulation of the resulting quantities, the solution of the differential equation can be recovered in an orderly fashion by inverting the transformation process to obtain a function of time. We assume that you are familiar with the fundamentals of differential uations outlined in Chapter 8, Section 8.4. The Laplace transform £[y(t)] of a function y(t) is defined to be
£[y(t)] = 1000
y(t)e-SI dt (10.5-1)
The integration removes t as a variable, and the transform is thus a function of only the Laplace variable s, ;’hich may be a complex number. The integral exists


for most of the commonly encountered functions if suitable restrictions are placed on s. An alternative notation is the use of the uppercase symbol to represent the transform of the corresponding lowercase symbol; that is,
Y(s) = £[y(t)]
We will use the one-sided transform. which assumes that the variable y(l) is 0 for 1 < O. For example, the stepfunction is such a function. Its name comes from the STEP FUNCfION fact that its graph looks like a stair step (see Figure 10.5-1).  The height of the step is M and is called the magnitude. The unit-step function,
denoted Us(I), has a height of M = 1 and is defined as follows:
{ o 1 < 0 us(t) = 1 t > 0
indeterminate t = 0
The engineering literature generally uses the term- step function, whereas the mathematical literature uses the name Heaviside -function. The Symbolic Math toolbox includes the Heaviside (t) function, which produces a unitstep function.
A step function of height M can be written as y(t) = Mus(t). Its transform
£[y(t)] = roo MUs(l)e-Sfdt = M100
e-stdt = -M e-
= M Jo _ 0 s 0 s
where we have assumed that the real part of s is greater than 0, so that the limit of e-st exists as t “-+ 00. Similar considerations of ~ region of convergence of the integral apply for other functions of time. ‘However, we need not concern ourselves with this topic here, because the transforms of all the common functions  have been calculated and tabulated. They can be obtained in MATLAB with the Symbolic Math toolbox by typing laplace (function), where function is a symbolic expression representing the function y(t) in (10.5-1). The default
independent variable is t, and the default result is a function of s. The optional form is laplace (function,x,y), where function is a function ofx and y is the Laplace variable.

Here is a session with some examples. The functions are 13, «=,and sin bt .
»syms b t
ans =
ans =
ans =
b/(s”2+b”2) I’lf Because the transform is integral, it has the properties of integral’s. In particular, it has the linearity p erty, which states that if a and b are not functions of t, then
C[afl(t) +b!2(t)] = aCUI(t)] +bC[h(t)] ‘(10.5-2)
The inverse Laplace transform C-I [Y(s)] is that time function y(t) whose transform is Y(s); that is, y(t) = C-I [Y(s»). The inverse operation is also linear. For example, the inverse transform of lO/s + 4/(s + 3) is 10+ 4e-J1• Inverse
transforms can be found using the ilaplace function. For example,
»syms b s
ans =
»ilaplp.c,e (l/,(s+b)~
ans = ‘
exp (-‘b*t)
ans =
, The transforms of derivatives are useful for solving differential equations. , I AppJ)4iN~~htegration’byparts to the definition of the transform, we obtain
, ? :}’f: (dy) 10d0y 100
‘·:,:c- .– ,= -e-S1dt = y(t)e-S1100+s y(t)e-S1dt
0.: “d, ‘ 0 dt 0 0 I :’,:: ‘:”,~”:;~;,~..
= sC[y(t)] – y(O) =sY(s) – y(O) (10.5-3)
This procedure can be extended to higher derivatives. For example, the result for the second derivative is

The general result for any order derivative is
c ddllt;’ ) =S”Y(S) – {;nsl.,-kgk_1 (10.5-5)

gk-I=~ !
dt 1=0
Application to Differential Equations
The derivative and linearity properties can be used to solve the differential
.’. . . ‘ .aj + y (10.5-7)
. ~j – I!:””
If we multiplYI both! s~des’ Of the ~uation b.y e:” and then integrate over time
from t =0 to~t = oo,l~e obtain
foo (ay + y)e-SI dt= robv(t)e-SI dt ”
~ ~.
£(ay + y) = £[bv(t)]
or, using the linearity property,
, ; a£(y) + £(y) = b£[v(t)]
Using the derivative property and the alternative transform nota~on, the preceding equation can be written as . . . J
. a[sY(s) – y(O)] + Y(s) =bV(s) . /
where V(s) is the transform of v. This equation is an algebraic equation for Y(s) in terms of V (s) and y(O). Its solution is
ay(O) b
Y(s) == -. — + –V(s)
as + I as + 1
Applying the inverse transform to (10.5-8) gives

y(t) = £~I [ay(O)] + £-1 [_h_V(S)]
as + I ,as + I
From the transform given earlier, it can be seen that
£-1 [ ay(O) ] ., £-1 [. y(O)’ ;]’r = y(O)e-l/a
as+l s+IJa.
which is the free response. The forced response is given by
£-1 [_b_. V(S)]
as + I
(10.5-8) I
. (10.5-10)
IThis inverse transform cannot be evaluated until V(s) is specified. Suppose v(t)
is a unit-step function. Then V(s) = 1/ s, and (10.5-10) becomes
c 1 [ b ]
s(as + 1)
To find the inverse transform, enter
»syms a b s
ans =
2*b*exp(-1/2*t/a)*sinh(1/2*t/a) Thus the forced response of (10.5-7) to a unit-step input is zs«: /20 sinh(1/2a),
which is equivalent to b(1 _,e-t/a). You can use the function with the dsol ve function to find
the step response, but the resulting expressions are more complicated than those obtained with the Laplace transform method. Consider the second-order model
j + l.4x +X = /(1)
Transforming this equation gives
[s2X(s) – sx(O) – x(O)] + 1.4[sX(s) – x(O)] + X(s) = F(s)
Solve for X(s).
x(O)s +x(o) + l.4x(O)· F(s)
X s = +—-‘–‘—
s2 + l.4s + 1 s2+ l.4s + 1
The free response is obtained from
x(t) = £-1 [X(O)s +x(o) + I.4X(O)]
Suppose the initial conditions arex(O) = 2 and x (0) = -3. Then the free response
is obtained from
X(I) = £-1 [S2 ~ ;4~’:1] ,
It can be found by typing .
The free response thus found is
X(I) = «?” [2COS (~I) .. 16~ sin (~I) 1
The forced response is obtained from
X(I) = £-1 [ F(s) ]
s2 + lAs + 1

If 1(/) is a unit-step function, F(s) = lis and the forced response is
x(t) = C- [ 1 ] I
s(s2 + l.4s + I)
To find the forced response, enter
The answer obtained is
x(t) = 1 – «?” [cos (~/) + 7~ sin (~t) 1 (10.5-13)
Input Derivatives Two similar mechanical systems are shown in Figure 10.5-2. In both cases the
input is a displacement y(t). Their equations of motion are mx +eX +kx =ky +cy (10.5-14)
” mx +eX +kx = ky (10.5-15) The only difference between these systems is that the system in Figure 1O.5-2a
has an equation of motion containing the derivative of the input function y(t). Both systems are examples of the more general differential equation mx +eX +kx =dy +gy (10.5-16) As noted earlier, you can use the Heaviside function with the dsolve function to find the step response of equations’ containing derivatives of the input,
but the resulting expressions are more complicated than those obtained with the Laplace transform method.
We now demonstrate how to use the Laplace transform to find the step response of equations containing derivatives of the input. Suppose the initial conditions are zero. Then transforming (10.5-16) gives


Let us compare the unit-step response of (10.5-16) for two cases using the values m = I, C = 1.4, and k = 1, with zero initial conditions. The two cases are .
g = 0 and g = 5.
With Y(s) = l/s, (l0.5-17) gives
X(s) = 1 +gs
s(s2 + l.4s + 1)
The response for the case g = 0 was found earlier. It is given by (10.5-13). The response for g = 5 is found,by typing
»syms S
The response obtained is
.x(t) = l_eo.7t [c~~'(·.J5ft) + 43ffi sin (ffir)] (..0.5-19)
, 10 . 51 10
Figure 10.5-3 shows the responses given by (10.5-13) and (10.5-19). The effect of differentiating the input is an increase in the response’s peak value.


Impulse Response
The area A under the curve of the pulse function shown in Figure 1O.5-4a is called the strength of the pulse. If we let the pulse duration T approach 0 while keeping the area A constant, we obtain the impulse function of strength A, represented by Figure 1O.5-4b.If the strength is 1,we have a unit impulse. The impulse can be thought of as the derivative of the step function and is a mathematical abstraction for convenience in analyzing the response of systems subjected to an input that is applied and removed suddenly, such as the force from a hammer blow. The engineering literature generally uses the term impulse function, whereas the mathematical literature uses the name Dirac delta function. The Symbolic Math toolbox includes the Dirac (t) function, which returns a unit impulse. You can use the Dirac function with the dsol ve function when the input function is an impulse, but the resulting expressions are more complicated than those obtained with the Laplace transform. It can be shown that the transform of an impulse of strength A is simply A. So, for example, to find the impulse response of i + l.4x +x = f(t), where f(t) is an impulse of strength A, for zero inital conditions; first obtain the transform


Direct Method
Instead of performing by hand the algebra required to find the response transform, we could use MATLAB to do the ~gebra for us. We now demonstrate the most direct way of using MATLAB to solve an equation with the Laplace transform. One advantage of this method is that we. are not required to use the transform
identities (l0.5-3) through (10.5-6) for the derivatives. Let us solve the equation
a dt + Y = I(t) (10.5-20)
with 1(t) = sin t, in terms of an unspecified value for y(O). Here is the session:
»syms a L s t
»y = sym(‘y(t)’)j .
»dydt = sym( ‘diff(y(t) ,t)’ }-~
»f = sin(t); ~
»eq = a*dydt+y-fj
»E = laplace(eq,t,s)
E =
a*(s*laplace(y(t),t,s)-y(~)) + laplace(y(t),t,s)-
»E = subs(E,’laplace(y(~),t,s) ‘,L)
E =
»L = solve(E,L)
L =
»I = simplify(ilaplace(L))
»I = col1ect(I,exp(-t/a))
I –
The answer is
—- –
I· !-, —
y(t) = –2 (sin t – a cos t + e-I/D[y(O) +a2y(0) +all
Note that this session consists of the following steps:
1. Define the symbolic variables, including the derivatives that appear in the equation. Note that y(t) is explicitly expressed as a function of t in these definitions.·· .
2. Move all terms to the left side of the equation and define the left side as a symbolicexpression, ‘. .
3. Apply the Laplace transformation to the differential equation to obtain an algebraic equation.


4. Substitute a symbolic variable, here L, for the expression laplace (y (t) , t, s) in the algebraic equation. Then solve the equation for the variable L, which is the transform of the solution.
5. Invert L to find the solution as a function of t. Note that this procedure can also be used to solve sets of equations.

Test Your Understanding
110.5-1 Find the Laplace transform of the following functions: 1 – e:” and cosht. Use the ilaplace function to check your answers
110.5-2 Use the Laplace transform to solve the problem 5y + 20y +15y= 30u· – 4it, where u(t) is a unit-step function and y(O) = 5, j'(O) = 1.

(Answer: y(t) = -1.6e-31 +4.6e-1 + 2.)

Posted on July 29, 2015 in Symbolic Processing with MATLAB

Share the Story

Back to Top
Share This