       Re: Laplace Transforms of piecewise continuous functions

• To: mathgroup at smc.vnet.net
• Subject: [mg28309] Re: Laplace Transforms of piecewise continuous functions
• From: Matthias Hertel <wir95cgu at studserv.uni-leipzig.de>
• Date: Mon, 9 Apr 2001 02:58:07 -0400 (EDT)
• References: <200104070744.DAA02009@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Michael,

you can use UnitStep as the building block for piecewise continuous
functions. Your function could be written as

3 UnitStep[t] - 5 UnitStep[t-2] + 2 UnitStep[t-3]

Transcribing functions from a list of cases to sums of UnitSteps
becomes tiresome after a while. It becomes easier if you define a box
function that is 1 in the closed interval [a,b] and 0 elsewhere (for
a <= b):

box[t_, a_, b_] := UnitStep[t - a] + UnitStep[b - t] - 1

Now you can easily define a triangle function

/ t,           0 <= t < alpha
f(t) = {  2 alpha - t, alpha <= t < 2 alpha
\ 0,           else

as

f[t_] := t box[t, 0, alpha] + (2 alpha - t)box[t, alpha, 2 alpha]

and apply LaplaceTransform to it:

LaplaceTransform[f[t], t, s]

The output looks a bit intimidating, but you can simplify it by
clueing in FullSimplify on our assumption that the lower bound of the
interval given to box is not greater than the upper bound:

FullSimplify[%, alpha>=0]

which gives

alpha s 2
(-1 + E       )
----------------
2 alpha s  2
E          s

Of course, there might be a more direct approach. But for some reason,
the alternate definition of box,

box[t_, a_, b_] := If[a <= t <= b, 1, 0]

doesn't play nice with LaplaceTransform (and ZTransform won't touch it
at all). As for why, I have no idea.

Separately integrating the pieces and adding could be the easiest
route (if you let Mathematica do the work):

pwlaplace[pieces : {{_, _, _} ..}, t_, s_] :=
Plus @@ (Integrate[Exp[-s t]#1, {t, #2, #3}] & @@@ pieces)

pwlaplace[{{t, 0, alpha}, {2alpha - t, alpha, 2alpha}}, t, s]
// Simplify

does the same as above with less hassle. Your example would be

pwlaplace[{{3, 0, 2}, {-2, 2, 3}}, t, s]

or

pwlaplace[{{3, 0, 2}, {-2, 2, 3}, {0, 3, Infinity}}, t, s]

HTH
Matthias

"Michael A. Powers" <mapowers at email.com> writes:
> Hi,
>
> The documentation isn't very clear on how to compute a Laplace Transform of
> a piecewise continuous function f(t).  Say I have a function f(t) such that:
>
> f(t) = {3 over 0<=t<2, -2 over 2<=t<3, 0 over 3 <=t}
>
> how can I use the LaplaceTransform[] function to compute this easily?
> (aside from separately integrating the pieces, and adding)
>
> Thanks,
>
> -Mike

```

• Prev by Date: Graphics Bug (or anomaly anyway)
• Next by Date: Front End Opening
• Previous by thread: Laplace Transforms of piecewise continuous functions
• Next by thread: Re: Laplace Transforms of piecewise continuous functions