Вы находитесь на странице: 1из 6

Spring 2006 Math 308-505 e−as − e−bs

L {u ab (t)} =
s
7 Laplace Transforms
L { f (t − p)u(t − p)} = e− ps F(s)
7.6 Transforms of Discontinuous and L { f (t)u(t − p)} = e− ps L { f (t + p)} (s)
Z T
Periodic Functions
g(t)e−st dt
Fri, 03/Mar 2006,
c Art Belmonte L {g(t)} =
G T (s)
= 0
1 − e−sT 1 − e−sT
Summary
Hand Examples
Heaviside function
Example A
The Heaviside unit step function is a piecewise continuous
Find the Laplace transform of e2(t−1) u(t − 1).
function defined by

0, for t < 0;
u(t) = Solution
1, for t ≥ 0.
1
For c ∈ R (typically c > 0), the translate of u is defined by Let f (t) = e2t . Then F(s) = L { f (t)} = . Therefore
s−2
 n o
0, for t < c; e−s
u c (t) = u(t − c) = L e2(t−1) u(t − 1) = L { f (t − 1)u(t − 1)} = e−s F(s) = .
1, for t ≥ c. s−2

The interval function is defined by Example B



 0, for t < a; Compute the Laplace transform of e−t u(t − 1).
u ab (t) = u(t − a) − u(t − b) = 1, for a ≤ t < b;

0, for t ≥ b.
Solution
The Heaviside function is easy to implement numerically in e−s
MATLAB in a vectorized fashion. To learn all about it, read Since L {u(t − 1)} = , we have
s
Chapter 6 (“Advanced use of dfield7”) in your lab manual! Also
read about Polking’s sqw square wave function M-file.  e−(s+1)
L e−t u(t − 1) = .
(It’s available to you on CalcLab and is easily transferred to s+1
your Windows XP LABS account or home.) Finally, study the
MATLAB Examples in this lecture handout.
Example C
Even better, as of Fall 2003 I have learned how to fully implement
π
the Heaviside function in a symbolic fashion for both Laplace Determine the Laplace transform of u(t − 2 ) cos 3t.
transform and graphing purposes. Accordingly, your work will be
much easier than the folks had it in the Spring!
Solution

We have cos(3(t + π )) = cos(3t + 32 π) = sin 3t via trig. So


Periodic Functions 2
π
 π − π2 s  π 3e− 2 s
If f (t + T ) = f (t) for all t, then f is periodic with period T (or L u(t − 2 ) cos 3t =e L cos(3(t + 2 )) = 2 .
T -periodic). Its window is defined as s +9

f (t), 0 ≤ t < T ; Example D
f T (t) =
0, t ≥ T.

 0, t < 0
Let f (t) = t, 0 ≤ t < 3 . Define f in terms of the
More Laplace transforms 
3, t ≥ 3
Heaviside function, then compute its Laplace transform.
In the following, a, b, c are constants, p is a nonnegative constant,
L { f (t)} = F(s) is the Laplace transform of f , and the Laplace
transform of the window g T of the piecewise continuous Solution
T -periodic function g is given by L {g T (t)} = G T (s).
f (t) = t (u(t) − u(t − 3)) + 3u(t − 3) = tu(t) − (t − 3)u(t − 3)
e−cs e −0s e−3s 1 − e−3s
L {u(t − c)} = implies L { f (t)} = 2 − 2 = .
s s s s2

1
Example E MATLAB Examples

e−2s We corroborate the results obtained in the Hand Examples via


Find the inverse Laplace transform of .
s +3 MATLAB’s Symbolic Math Toolbox. Here are the diary files.

Solution Example A [revisited]


%
1
Let F(s) = . Then f (t) = L−1 {F(s)} = e−3t . Thus % NSS-7.6/Example A
 s + 3 %
syms t
1
L−1 e−2s = u(t − 2) f (t − 2) = u(t − 2)e−3(t−2) u1 = heaviside(t-1);

 s + 3 f = exp(2*(t-1)) * u1; pretty(f)


0, t < 2;
= exp(2 t - 2) heaviside(t - 1)
e−3(t−2) , t ≥ 2. F = simple(laplace(f)); pretty(F)

exp(-s)
-------
Example F s - 2
%
echo off; diary off
e−s
Compute the inverse Laplace transform of .
s(s − 2)2
Example B [revisited]
%
Solution % NSS-7.6/Example B
%
syms t
1 1/4 1/4 1/2
Let F(s) = = − + via cpf. Then u1 = heaviside(t-1);
s(s − 2) 2 s s − 2 (s − 2)2 f = exp(-t) * u1; pretty(f)
e−s
f (t) = 14 − 14 e2t + 12 te2t . Thus L−1 is equal to exp(-t) heaviside(t - 1)

 s(s − 2)2 
F = simple(laplace(f)); pretty(F)

u(t − 1) f (t − 1) = u(t − 1) 14 − 14 e2(t−1) + 12 (t − 1)e2(t−1) . exp(-1 - s)


-----------
1 + s
%
echo off; diary off
Example G

Consider the driven, undamped oscillator Example C [revisited]


y 00 + 4y = f (t), y(0) = 0, y 0 (0) = 0, %
% NSS-7.6/Example C
%
with the driving force f (t) = u(t − 1) − u(t − 2). Solve the syms t
up2 = heaviside(t-pi/2);
initial value problem; i.e., determine the solution, or response, to f = up2 * cos(3*t); pretty(f)
the input f (t).
heaviside(t - 1/2 pi) cos(3 t)
F = simple(laplace(f)); pretty(F)

Solution exp(- 1/2 s pi)


3 ---------------
2
OK, campers: you know the drill from Section 7.5! s + 9
%
echo off; diary off
e−s e−2s
1. s 2 Y (s) − sy(0) − y 0 (0) + 4Y (s) = − .
s s
Example D [revisited]
e−s e−2s
2. s 2 Y (s) + 4Y (s) = − . %
% NSS-7.6/Example D
s s
%
3. With the aid of cpf, we have syms t
u = heaviside(t);
u3 = heaviside(t-3);
e−s e−2s f = t*(u-u3) + 3*u3; pretty(f)
Y (s) = −
s(s + 4) s(s 2 + 4)
2
t (heaviside(t) - heaviside(t - 3))
1 −s 1 −s 1 −2s 1 −2s + 3 heaviside(t - 3)
4e 4 se 4e 4 se
Y (s) = − − + %
s s2 + 4 s s2 + 4 t = linspace(-2, 5);
v = eval(vectorize(f));
  plot(t,v, ’LineWidth’, 2); grid on
xlabel(’t’); ylabel(’f(t)’)
4. Thus y(t) = 14 − 14 cos(2(t − 1)) u(t − 1) title(’NSS-7.6/Example D: f(t)’)
  axis([-2 5 -1 4])
+ 14 cos(2(t − 2)) − 14 u(t − 2). %
F = simple(laplace(f)); pretty(F)

2
y = ilaplace(Ys); pretty(y) % #4
1 - exp(-3 s)
------------- heaviside(t - 1) (1/4 - 1/4 cos(2 t - 2))
2 + (- 1/4 + 1/4 cos(2 t - 4)) heaviside(t - 2)
s %
% t = linspace(0,8);
echo off; diary off y = eval(vectorize(y));
plot(t,y); grid on
xlabel(’t’); ylabel(’y’)
title(’NSS-7.6: Example G’)
Example E [revisited] %
echo off; diary off
%
% NSS-7.6/Example E
%
syms s 396/23 [periodic function, numerically graphed]
F = exp(-2*s) / (s+3); pretty(F)

exp(-2 s) e−t , 0 < t < 1,
Let f (t) = and f has period 2. Plot f (t)
---------
s + 3
1 1 < t < 2,
f = ilaplace(F); pretty(f) for 0 ≤ t ≤ 8, and compute the Laplace transform of f .
heaviside(t - 2) exp(-3 t + 6)
% That is, f(t) = u(t-2) * exp(-3*(t-2)).
% Solution
echo off; diary off

Here is a graphing script M-file and the plot it produces.


Example F [revisited]
%
% % NSS4-396/23g: Here is a graph of a periodic function f
% NSS-7.6/Example F % using MATLAB logical functions (as described in Chapter 6
% % of your lab manual).
syms s %
F = exp(-s) / (s * (s-2)ˆ2); pretty(F) t = linspace(0, 7.999, 500);
f = exp(-mod(t,2)) .* (0<=t & t<1) ...
exp(-s) + 1 .* (1<=t & t<2) ...
---------- + exp(-mod(t,2)) .* (2<=t & t<3) ...
2 + 1 .* (3<=t & t<4) ...
s (s - 2) + exp(-mod(t,2)) .* (4<=t & t<5) ...
f = ilaplace(F); pretty(f) + 1 .* (5<=t & t<6) ...
+ exp(-mod(t,2)) .* (6<=t & t<7) ...
(- 3/4 exp(2 t - 2) + 1/4 + 1/2 exp(2 t - 2) t) + 1 .* (7<=t & t<8);
* heaviside(t - 1) plot(t,f,’*’); grid on
% That is, axis([0, 8, -0.5 1.5])
% f(t) = u(t-1) * %
% ( -3/4*exp(2*(t-1)) + 1/4 + 1/2*t*exp(2*(t-1)) ). echo off; diary off
% NSS4−396/23g: Numerical graph of a periodic function
echo off; diary off
1.5

Example G [revisited]
1
%
% NSS-7.6/Example G
%
syms s t Ys 0.5
f

y = sym(’y(t)’)
y =
y(t)
f = heaviside(t-1) - heaviside(t-2);
nde = diff(y,t,2) + 4*y - f; 0
pretty(nde) % #0

/ 2 \
|d | −0.5
|--- y(t)| + 4 y(t) - heaviside(t - 1) + heaviside(t - 2) 0 2 4 6 8
| 2 | t
\dt /
ltde = laplace(nde); % #1
ltde = chiclet(ltde); pretty(ltde)
Now we compute the Laplace transform of f using the theorem
exp(-s) exp(-2 s) for the Laplace transform of a periodic function.
s (s Ys - y(0)) - Dy(0) + 4 Ys - ------- + ---------
s s
eq = subs(ltde, {’y(0)’ ’Dy(0)’}, {0 0}); % #2 %
pretty(eq) % NSS4-396/23
%
2 exp(-s) exp(-2 s) syms s t
s Ys + 4 Ys - ------- + --------- I1 = int(exp(-t)*exp(-s*t), t, 0, 1);
s s pretty(I1)
Ys = solve(eq, Ys); pretty(Ys) % #3
exp(-s - 1) - 1
exp(-s) - exp(-2 s) - ---------------
------------------- s + 1
2 I2 = int(1*exp(-s*t), t, 1, 2);
s (s + 4) pretty(I2)

3
396/28 [YAPF: yet another periodic function]
exp(-2 s) - exp(-s)
- -------------------
s Compute the Laplace transform of this half-rectified sine wave f .
F = (I1+I2) / (1 - exp(-2*s)); pretty(F)

exp(-s - 1) - 1 exp(-2 s) - exp(-s) NSS4−396/28: Half−rectified sine wave


- --------------- - ------------------- 2
s + 1 s
---------------------------------------
1 - exp(-2 s) 1.5
%
echo off; diary off 1

0.5

y
396/26 [periodic function, symbolically graphed]
0
Compute the Laplace transform of the sawtooth wave f shown.
−0.5
NSS4−396/26: Sawtooth Wave
1.5 −1
0 5 10 15
1
t
0.5
f

0
−0.5 Solution
0 a 2a 3a 4a 5a 6a
t
Here is the script M-file that produced the plot.

%
Solution % NSS4-396/28g: Graph of half-rectified sine wave
%
syms k t
First off, here is the script M-file that produced the plot. u = sym(’Heaviside(t)’);
u 2k pi = subs(u, t, t-2*k*pi)
u 2kp1 pi = subs(u, t, t-(2*k+1)*pi)
% f = symsum(sin(t)*(u 2k pi - u 2kp1 pi), k, 0, 2);
% NSS4-396/26g t = linspace(0, 15, 2000);
% ff = eval(vectorize(f));
% Here is a graph of a sawtooth wave! This time we use a plot(t,ff); grid on
% symbolic implementation via Heaviside step functions. axis([0 15 -1 2])
% For graphing purposes, we have chosen the value 1 for the %
% parameter a. echo off; diary off
%
a = 1;
syms k t
u = sym(’Heaviside(t)’); The third time’s the charm. We compute the Laplace transform of
uka = subs(u, t, t-k*a)
ukp1a = subs(u, t, t-(k+1)*a) f using the theorem for the Laplace transform of a periodic
f = symsum((t/a - k)*(uka - ukp1a), k, 0, 5); function.
t = linspace(0, 6, 500);
ff = eval(vectorize(f));
plot(t,ff,’+’); grid on
%
axis equal
% NSS4-396/28
axis([0, 6, -0.5, 1.5])
%
% DIG IT: Custom tickmarks!
syms s t
set(gca,’XTickLabel’,{’0’;’a’;’2a’;’3a’;’4a’;’5a’;’6a’})
F = int(sin(t) * exp(-s*t), t, 0, pi) ...
%
/ (1 - exp(-2*pi*s));
echo off; diary off pretty(F)

1 + exp(pi s)
-------------------------------------
Once again, we compute the Laplace transform of f using the 2
theorem for the Laplace transform of a periodic function. exp(pi s) (s + 1) (1 - exp(-2 pi s))
%
echo off; diary off
%
% NSS4-396/26
%
syms a s t
F = int(t/a * exp(-s*t), t, 0, a) / (1 - exp(-a*s));
397/38 [IVP with discontinuous forcing function]
pretty(F)
00 + 2y 0 + 10y = g(t); y(0) = −1, y 0 (0) = 0. Here
Solve y
exp(-s a) + exp(-s a) s a - 1
- -----------------------------  10, 0 ≤ t ≤ 10
2
g(t) = 20, 10 < t < 20 .
a s (1 - exp(-s a))

% 0, 20 < t
echo off; diary off Then graph the solution y(t) for 0 ≤ t ≤ 35.

4
Solution opened for the next 10 minutes, delivering a 0.4 kg/L
concentration at 12 L/min. Finally, valve A is shut and valve B is
Formulate g in terms of Heaviside step functions, then do the switched back in. The exit valve C removes brine at a flow rate of
usual 4-step procedure! 12 L/min, thereby keeping the volume constant.

%
Find the concentration c(t) of salt in the tank as a function of
% NSS4-397/38
%
time. Graph c(t) over 0 ≤ t ≤ 30, then again over 30 ≤ t ≤ 400.
syms s t Ys
y = sym(’y(t)’);
u = heaviside(t);
u10 = heaviside(t-10);
u20 = heaviside(t-20);
g = 10*(u-u10) + 20*(u10-u20);
Solution
de0 = diff(y,t,2) + 2*diff(y,t) + 10*y - g;
pretty(de0)

/ 2 \ Here is a diary file followed by the two plots.


|d | /d \
|--- y(t)| + 2 |-- y(t)| + 10 y(t) - 10 Heaviside(t) - 10 Heaviside(t - 10)
| 2 | \dt /
\dt / %
+ 20 Heaviside(t - 20) % NSS4-398/62
% 1 %
ltde = laplace(de0); syms s t Xs
ltde = chiclet(ltde); x = sym(’x(t)’);
pretty(ltde) u = sym(’Heaviside(t)’);
u10 = subs(u, t, t-10);
10 exp(-10 s) u20 = subs(u, t, t-20);
s (s Ys - y(0)) - Dy(0) + 2 s Ys - 2 y(0) + 10 Ys - ---- - 10 ---------- c = 3/5*(u-u10) + 2/5*(u10-u20) + 3/5*u20;
s s de0 = diff(x,t) - (12*c - 12*x/500);
exp(-20 s) pretty(de0)
+ 20 ----------
s /d \
% 2 |-- x(t)| - 36/5 Heaviside(t) + 12/5 Heaviside(t - 10)
eq0 = subs(ltde, {’y(0)’, ’Dy(0)’}, {-1, 0}); \dt /
pretty(eq0) - 12/5 Heaviside(t - 20) + 3/125 x(t)
% 1
10 exp(-10 s) exp(-20 s) ltde = laplace(de0);
s (s Ys + 1) + 2 + 2 s Ys + 10 Ys - ---- - 10 ---------- + 20 ---------- ltde = chiclet(ltde);
s s s pretty(ltde)
% 3
Ys = solve(eq0, Ys); pretty(Ys) exp(-10 s) exp(-20 s)
s Xs - x(0) - 36/5 1/s + 12/5 ---------- - 12/5 ---------- + 3/125 Xs
2 s s
s + 2 s - 10 - 10 exp(-10 s) + 20 exp(-20 s) % 2
- --------------------------------------------- eq0 = subs(ltde, ’x(0)’, 100);
2 pretty(eq0)
s (s + 2 s + 10)
% 4 exp(-10 s) exp(-20 s)
y = ilaplace(Ys); pretty(y) s Xs - 100 - 36/5 1/s + 12/5 ---------- - 12/5 ---------- + 3/125 Xs
s s
(2 exp(-t + 20) cos(3 t - 60) + 2/3 exp(-t + 20) sin(3 t - 60) - 2) % 3
Heaviside(t - 20) + Xs = solve(eq0, Xs); pretty(Xs)
(-exp(-t + 10) cos(3 t - 30) - 1/3 exp(-t + 10) sin(3 t - 30) + 1)
Heaviside(t - 10) - 2 exp(-t) cos(3 t) - 2/3 exp(-t) sin(3 t) + 1 125 s + 9 - 3 exp(-10 s) + 3 exp(-20 s)
% Graph via plot. 100 ---------------------------------------
t = linspace(0, 35, 500); s (125 s + 3)
y = eval(vectorize(y)); % 4
plot(t,y); grid on x = ilaplace(Xs); pretty(x)
%
echo off; diary off 100 exp(- 3/125 t) + 600 exp(- 3/250 t) sinh(3/250 t)
- 200 Heaviside(t - 10) exp(- 3/250 t + 3/25) sinh(3/250 t - 3/25)
+ 200 Heaviside(t - 20) exp(- 3/250 t + 6/25) sinh(3/250 t - 6/25)
save x = x;
Beauty, eh? % Graph early on...
t = linspace(0, 30, 500);
x = eval(vectorize(x));
c = x/500;
plot(t,c); grid on
NSS4−397/38 % ...and in the fullness of time
figure % new plot
2.5 t = linspace(30, 400, 500);
x = eval(vectorize(save x));
c = x/500;
2 plot(t,c); grid on
% Concentration expression
c = save x / 500; pretty(c)
1.5 1/5 exp(- 3/125 t) + 6/5 exp(- 3/250 t) sinh(3/250 t)
- 2/5 Heaviside(t - 10) exp(- 3/250 t + 3/25) sinh(3/250 t - 3/25)
+ 2/5 Heaviside(t - 20) exp(- 3/250 t + 6/25) sinh(3/250 t - 6/25)
1 %
y

echo off; diary off


0.5 NSS4−398/62: Concentration early on
0.4
0

−0.5
0.35
Concentration (kg/L)

−1
0 10 20 30 40
t
0.3

398/62
0.25
A mixing tank initially holds 500 L of a brine solution with a salt
concentration of 0.2 kg/L. For the first 10 minutes of operation,
0.2
valve B is open, adding 12 L/min of brine containing a 0.6 kg/L 0 5 10 15 20 25 30
salt solution. After 10 minutes, valve B is closed and valve A is Time (minutes)

5
NSS4−398/62: Concentration in the long run
0.6

0.55
Concentration (kg/L)

0.5

0.45

0.4

0.35

0.3
0 100 200 300 400
Time (minutes)

Вам также может понравиться