Problem: Obtain the Laplace transform for the function defined in the following figure.
Function f(t) to obtain its Laplace transform
Comment: Mathematica solution was easier than Matlab’s. In Matlab the definition of the Laplace transform is applied to each piece separately and the result added. Not finding the piecewise maple function to access from inside MATLAB did not help.
Mathematica
Remove["Global`*"]; f[t_] := Piecewise[{{0,t<0}, {t,t>= 0 && t< T}, {T, t>T}}] Simplify[LaplaceTransform[f[t],t,s] ,{T>0}]
|
Out[]= (1 - E^((-s)*T))/s^2 |
Matlab
clear all; syms T t s; syms s positive; I1 = int(t*exp(-s*t),t,0,T); I2 = int(T*exp(-s*t),t,T,Inf); result = simple(I1+I2); pretty(result)
|
1 - exp(-T s) ------------- 2 s |
Maple