Finding inverse Laplace Transforms using Matlab

T
Timothy · Jan 4, 2021 · 2.3K views
Question
Does anyone know how to get the inverse laplace transform in MATLAB? Ideally entering the Laplace form of the equation, and getting the output in the time domain. Thanks!! P.S. if you have an example you're willing to share that would be appreciated!
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Nov 20, 2025
A reasonably illustrative example:
 
 
syms H(s) s t 
H(s) = (s^2 + 3*s + 5)/(s^3 + 5*s^2 +6*s + 9);
Hpf = partfrac(H)
h(t) = vpa(ilaplace(Hpf,s,t))
hfcn = matlabFunction(h)

producing

h(t) =
0.6241318855835944579323146742924*exp(-4.0690229960401146971234049368325*t) + 0.3758681144164055420676853257076*exp(-0.46548850197994265143829753158373*t)*cos(1.4124990678323177947660216914026*t) + 0.50589008998062620975227487302694*exp(-0.46548850197994265143829753158373*t)*sin(1.4124990678323177947660216914026*t)

and (after a bit of editing):

hfcn = @(t)exp(t.*-4.069022996040115).*6.241318855835945e-1+exp(t.*-4.654885019799427e-1).*cos(t.*1.412499067832318).*3.758681144164055e-1+exp(t.*-4.654885019799427e-1).*sin(t.*1.412499067832318).*5.058900899806262e-1
Using the partfrac (partial fraction decomposition) function is frequently necessary. You can use the vpa function to simplify expressions that cannot easily be simplified using the simplify and related functions. The matlabFunction function will convert the expressions into executable numeric (as opposed to symbolic) code.
If you are using the Symbolic Math Toolbox to work with control systems, use the sym2poly function to export your symbolic polynomial coefficients to create transfer functions with the other Toolboxes.
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!