Written and maintained by CASRAI Editorial Board
Last updated
In MATLAB, ilaplace is the Symbolic Math Toolbox function used to compute the analytical inverse Laplace transform of an expression. It maps functions from the complex frequency domain (s-domain) back to the continuous time domain (t-domain), enabling researchers to solve linear differential equations, evaluate dynamic transfer functions, and model continuous physical systems analytically.
What it is used for in research
Mathematical modeling across physics, bioengineering, and control engineering frequently relies on the Laplace transform to convert calculus operations into algebraic manipulations. While numerical solvers compute approximations at discrete timesteps, the MATLAB ilaplace function calculates exact, closed-form symbolic solutions in continuous time.
Primary research applications include:
- Differential Equation Analysis: Solving initial value problems (IVPs) for non-homogeneous ordinary differential equations. By converting derivative operations into polynomial multiplications, researchers solve for the output variable algebraically and invert the result with
ilaplaceto find the exact analytical trajectory, complementing differential equations and derivatives in MATLAB. - Control Systems and Transient Analysis: Evaluating the time-domain impulse, step, and frequency responses of linear time-invariant (LTI) systems from rational transfer functions.
- Signal Processing and Filters: Deriving continuous-time filter kernel responses, circuit transient decay rates, and impedance network behaviors within broader signal analysis in MATLAB workflows.
- Pharmacokinetics and Compartmental Modeling: Solving multi-compartment pharmacokinetic models where drug concentration dynamics across biological tissues yield coupled linear rate equations.
- Scientific Documentation and Publication: Generating verified mathematical expressions that can be exported directly into academic manuscripts and formatted alongside Laplace transform equations in LaTeX.
Install or access (official source only)
The ilaplace function is part of the Symbolic Math Toolbox, an official add-on product developed by MathWorks. It is not included in base MATLAB and must be licensed and installed separately.
To verify whether the Symbolic Math Toolbox is already installed in your MATLAB environment, execute:
ver('symbolic')
If installed, the command returns the version number and release build (e.g., Version 24.2, R2024b). Alternatively, test license availability with:
license('test', 'symbolic_toolbox')
To install or access the toolbox through official MathWorks channels:
- MATLAB Add-On Explorer: In the MATLAB desktop, open the Home tab, navigate to the Environment section, click Add-Ons, and select Get Add-Ons. In the Add-On Explorer search bar, enter Symbolic Math Toolbox, click the product tile, and select Install.
- MathWorks Installer: Launch the official MathWorks installer for your release, log in with your MathWorks Account, and check the box for Symbolic Math Toolbox during package selection.
- MATLAB Online: Access MATLAB through a web browser at
matlab.mathworks.comusing an institutional or individual license that entitles Symbolic Math Toolbox access. Cloud instances automatically include the toolbox if provisioned by your campus or organization license.
Step-by-step task
Computing an inverse Laplace transform in MATLAB involves declaring symbolic variables, defining the s-domain expression, invoking ilaplace, and formatting the resulting time-domain function. Follow these numbered steps to execute the task reliably in scripts or Live Scripts, following best practices for MATLAB coding fundamentals.
Step 1: Declare symbolic variables with syms
Because ilaplace operates on symbolic mathematical objects rather than numerical double arrays, you must declare independent variables using syms before defining any expressions:
% Declare complex frequency (s) and time (t)
syms s t
% Declare parameters as real positive values when physical constraints apply
syms a omega positive
Step 2: Define the s-domain expression
Construct the s-domain transfer function or algebraic term. For example, specify a classic damped oscillator response:
% Define F(s) = omega / ((s + a)^2 + omega^2)
F = omega / ((s + a)^2 + omega^2);
Step 3: Execute the inverse Laplace transform
Call ilaplace with the expression. By default, MATLAB assumes s is the input independent variable and transforms it into the output time variable t:
% Compute inverse Laplace transform f(t)
f = ilaplace(F)
MATLAB returns the exact analytical solution:
% Result:
% f = exp(-a*t)*sin(omega*t)
When working with custom variable names (for instance, transforming frequency variable p into spatial variable x), specify both variables explicitly as arguments: ilaplace(F, p, x).
Step 4: Solve an ordinary differential equation with initial conditions
In research workflows, ilaplace frequently solves non-homogeneous ODEs. Consider the second-order system:
y”(t) + 3y'(t) + 2y(t) = 0, with initial conditions y(0) = 1 and y'(0) = 0.
Applying the Laplace transform yields:
(s² Y(s) – s·y(0) – y'(0)) + 3(s Y(s) – y(0)) + 2Y(s) = 0
(s² + 3s + 2) Y(s) – s – 3 = 0 ⟹ Y(s) = (s + 3) / (s² + 3s + 2)
Invert this algebraic expression in MATLAB:
syms s t
Y = (s + 3) / (s^2 + 3*s + 2);
y_t = ilaplace(Y)
MATLAB computes the analytical solution involving exponential functions in MATLAB:
% y_t = 2*exp(-t) - exp(-2*t)
Step 5: Convert control system polynomials to symbolic expressions
If transfer function numerator and denominator polynomials are stored as numerical coefficient vectors, convert them into symbolic polynomials with poly2sym before inverting:
num = [1 0]; % Numerator: s
den = [1 2 5]; % Denominator: s^2 + 2s + 5
syms s t
G_sym = poly2sym(num, s) / poly2sym(den, s);
g_t = ilaplace(G_sym)
% Result: exp(-t)*(cos(2*t) - (1/2)*sin(2*t))
Output and how to read it
The return value of ilaplace is a symbolic object (data class sym). Interpreting the returned expression depends on whether MATLAB resolved a standard closed form, introduced generalized distributions, or returned an unevaluated integral.
Standard elementary and transcendental forms
When the s-domain expression has rational poles, MATLAB returns linear combinations of elementary mathematical functions:
exp(-a*t): Decaying or growing real exponentials arising from real poles at s = -a.cos(omega*t)andsin(omega*t): Harmonic oscillations arising from imaginary conjugate pole pairs at s = ±i·omega.t^n: Algebraic polynomial ramps arising from repeated poles at the origin s^(n+1).
Step functions and distributions
For systems involving delays or improper rational transfer functions, MATLAB introduces specialized generalized functions:
heaviside(t): The unit step function, indicating that the solution is causal and defined for t ≥ 0. When shifting occurs (e.g., from terms likeexp(-s*tau)), MATLAB outputsheaviside(t - tau).dirac(t): The Dirac delta impulse function. This appears when the degree of the numerator polynomial is equal to or greater than the denominator polynomial. For example,ilaplace(s / (s + 1))returnsdirac(t) - exp(-t).
Unevaluated symbolic integrals
If MATLAB cannot find an analytical antiderivative in its table of integral transforms, it does not throw an error; instead, it returns an unevaluated symbolic expression: ilaplace(F, s, t). This signals that the closed-form inverse Laplace transform cannot be expressed using standard elementary or supported special functions.
Formatting and converting output
To inspect or plot the resulting symbolic time-domain expression, use official conversion tools:
simplify(f): Collapses redundant algebraic factors and applies trigonometric identities.pretty(f): Displays the expression in ASCII textbook mathematical layout in the Command Window.fplot(f, [0, 10]): Quickly plots the continuous symbolic function over a specified time span without manual vector discretization.matlabFunction(f): Converts the symbolic object into an optimized anonymous function handle (e.g.,f_num = matlabFunction(f)) for numerical simulation, ODE solvers, or vectorized evaluation over large time arrays.
Troubleshooting
When executing ilaplace matlab commands, researchers frequently encounter specific runtime errors or unexpected representations. Use the verified solutions below to resolve them:
Undefined function or variable ‘ilaplace’
Cause: The Symbolic Math Toolbox is either not installed, not activated, or shadowed on the MATLAB search path.
Remedy: Run ver('symbolic') to verify installation. If the toolbox is present but unrecognized, restore default search paths by executing:
restoredefaultpath;
rehash toolboxcache;
Function ‘ilaplace’ is not defined for values of class ‘tf’
Cause: Attempting to pass a linear time-invariant transfer function object created by the Control System Toolbox (tf) directly into ilaplace.
Remedy: Extract the numerator and denominator polynomial vectors using tfdata, convert them with poly2sym, and pass the resulting symbolic ratio to ilaplace:
% Convert tf object 'sys' to symbolic expression
[num, den] = tfdata(sys, 'v');
syms s
G_sym = poly2sym(num, s) / poly2sym(den, s);
g_t = ilaplace(G_sym);
Unevaluated output ilaplace(F, s, t) returned
Cause: The expression is too complex for standard symbolic pattern matching, or contains fractional powers and branch cuts.
Remedy: Decompose higher-order rational functions into partial fractions prior to inversion using partfrac:
F_decomposed = partfrac(F, s);
f = ilaplace(F_decomposed);
If analytical inversion is mathematically impossible, use numerical inverse Laplace transform algorithms, such as the Gaver-Stehfest algorithm or the Talbot contour integration method, available through academic community packages.
Unexpected variable chosen as transformation variable
Cause: Calling ilaplace(F) on expressions that do not contain the letter s. When s is absent, MATLAB calls symvar(F, 1) to select the default variable alphabetically, which can yield unexpected results.
Remedy: Always specify both the independent variable and the target transformation variable explicitly: ilaplace(F, var, transVar).
Free alternatives (table)
Researchers conducting computational mathematics without access to proprietary MATLAB licenses can utilize open-source symbolic packages and numerical libraries. The table below compares verified free alternatives capable of computing inverse Laplace transforms:
| Software / Package | Primary Interface / Command | License Model | Computation Type | Key Advantage & Syntax Example |
|---|---|---|---|---|
| GNU Octave (Symbolic Package) | ilaplace(G, s, t) via @sym |
GNU GPLv3 (Free & Open Source) | Analytical (SymPy IPC backend) | Direct drop-in compatibility with MATLAB scripts:pkg load symbolic; |
| Python (SymPy) | inverse_laplace_transform(F, s, t) |
Modified BSD (Free & Open Source) | Analytical (Pure Python CAS) | Seamless integration into scientific Python pipelines (NumPy, SciPy, Jupyter):from sympy import inverse_laplace_transform, symbols |
| Maxima | ilt(expr, s, t) |
GNU GPLv2 (Free & Open Source) | Analytical (Lisp CAS engine) | Lightweight, dedicated computer algebra system with robust rational fraction integration:ilt(1/(s+a), s, t); |
| Python (mpmath) | mpmath.invertlaplace(f, t, method='talbot') |
BSD (Free & Open Source) | Numerical (Arbitrary precision) | Inverts functions numerically where no analytical closed form exists, supporting Talbot, Euler, and de Hoog algorithms. |
| SciPy (scipy.signal) | signal.invres(r, p, k) |
BSD (Free & Open Source) | Numerical / Residue expansion | Partial fraction residue expansion for rational polynomials, feeding discrete time-domain simulations with signal.step and signal.impulse. |
FAQ
What is the difference between laplace and ilaplace in MATLAB?
The laplace function computes the forward Laplace transform, mapping a continuous-time expression f(t) into the complex frequency domain F(s) by evaluating the unilateral integral from 0 to infinity of f(t)·exp(-s·t) dt. Conversely, ilaplace computes the inverse Laplace transform, mapping an s-domain function F(s) back into the time-domain function f(t) via the Bromwich inversion integral.
Can MATLAB ilaplace handle symbolic matrices and vectors?
Yes. If you pass a symbolic array or matrix of expressions to ilaplace, MATLAB evaluates the inverse Laplace transform element-wise across all entries, returning a symbolic matrix of identical dimensions.
Why does ilaplace output heaviside(t) in the result?
In standard mathematical physics, the unilateral Laplace transform assumes signals are zero for t < 0. MATLAB includes heaviside(t) in its output to explicitly enforce this causality condition, ensuring that evaluating the resulting function at negative time values yields zero.
How do I plot the time-domain response produced by ilaplace?
You can plot the symbolic result directly using fplot(f, [0, 10]). For large datasets or integration into existing simulation scripts, convert the symbolic expression to a numerical function handle using f_num = matlabFunction(f), define a time vector t_vec = linspace(0, 10, 1000), and call plot(t_vec, f_num(t_vec)).
Can ilaplace invert discrete or sampled time-series data?
No. The ilaplace function is strictly an analytical symbolic transform tool designed for mathematical expressions. For sampled empirical data, researchers use numerical inverse Laplace transform algorithms, Discrete Fourier Transform (FFT) methods, or time-domain system identification algorithms.
Sources (official docs)
- MathWorks Documentation: ilaplace – Inverse Laplace transform. MathWorks Symbolic Math Toolbox, R2024b. URL: https://www.mathworks.com/help/symbolic/sym.ilaplace.html. Accessed November 8, 2026.
- Octave-Forge Documentation: Function Reference: @sym/ilaplace. GNU Octave Symbolic Package, Version 3.2.x. URL: https://octave.sourceforge.io/symbolic/function/@sym/ilaplace.html. Accessed November 8, 2026.
- SymPy Documentation: Integrals – inverse_laplace_transform. SymPy 1.13/1.14 Documentation. URL: https://docs.sympy.org/latest/modules/integrals/integrals.html. Accessed November 8, 2026.







