File Exchange

## Numerical Inverse Laplace Transform

version 1.0.0.0 (176 KB) by Tucker McClure

### Tucker McClure (view profile)

Numerical approximation of the inverse Laplace transform for use with any function defined in "s".

Updated 04 Jan 2013

This set of functions allows a user to numerically approximate an inverse Laplace transform for any function of "s". The function to convert can be passed in as an argument, along with the desired times at which the function should be evaluated. The output is the response of the system at the requested times.

For instance, consider a ramp function.
f = @(s) 2/s^2;
t = [1 2 3 4 5]';
talbot_inversion(f, t)

The time response output is [2 4 6 8 10], as expected.

These methods can be used on problems of considerably more difficulty as well and are intended to approximate an inverse Laplace transform where an exact solution is unknown.

Two basic solvers (Euler and Talbot) are included, along with *symbolic* versions of those solvers. The symbolic solutions take substantially longer to calculate, but are capable of any desired accuracy. Also, the symbolic versions require the Symbolic Toolbox, whereas the basic versions do not.

Please see example_inversions.pdf or html/example_inversions.html to get started!

Kai-Wen Tien

pengxiang qiu

### pengxiang qiu (view profile)

Hi my friend

I'm trying to apply your inverse Laplace to find the approximate solution of fractional odes. but ...

t = 0:0.01:1;
alpha =0.91;f0 =1;b=1;
for i=1: size(t,2)
y(i)=f0*mlf(alpha,1, b*(0.01*(i-1)).^alpha);
end
plot(t,y, ...
t, talbot_inversion_sym(@(s) B(alpha) * s ^ (alpha - 1) * f0 / (s ^ (alpha) * B(alpha) + s ^ alpha * alpha * b - s ^ alpha * b - alpha * b), t,50), '.');
xlabel('Time');
legend('Real Values', 'Approximation');

%% T = 0
% Inverse Laplace transforms aren't defined for t = 0, but only t > 0.

where,

function Ba = B(alpha)
if alpha ~= 1
Ba = 1 - alpha + (alpha/gamma(alpha));
else
Ba = 1;
end
end

Howard Lam

Jinting Huang

### Jinting Huang (view profile)

Hi Tucker,
I encounter a problem to obtain inverse Laplace and Fourier transform numerically. The parameters in function like this: n=p+kw, where p and w are laplace transform and fourier transform parameter. And k is constant. Would you so kind give me some advice how to perform the inverse?

Kai Koike

### Kai Koike (view profile)

This really helped me. Thank you!

Liubov Tupikina

Liubov Tupikina

### Liubov Tupikina (view profile)

It helps my calculations greatly, thank you very much!
Just a question: I get for some continuous functions f(s) some missing values in f(t).
Which parameters of inverse we should use?
Sorry if it is too concrete question.

Tucker McClure

### Tucker McClure (view profile)

Hi Ederson. Thanks! There's no need to cite me; the real work was done in the following paper (which is cited in the help text for the functions in this package):

Abate, Joseph, and Ward Whitt. "A Unified Framework for Numerically Inverting Laplace Transforms." INFORMS Journal of Computing, vol. 18.4 (2006): 408-421. Print.

The paper is also online: http://www.columbia.edu/~ww2040/allpapers.html.

I merely programmed their suggestions.

Ederson Costa

### Ederson Costa (view profile)

How to cite your program. Do you have a specific article?

smog

Ean Tat Ooi

### Ean Tat Ooi (view profile)

Thanks Tucker. This is really helpful.

Li Zhang

Thanks, Tucker!

Tucker McClure

### Tucker McClure (view profile)

Hi Li Zhang,

Thanks for the rating! This code was all based on the following work:

Abate, Joseph, and Ward Whitt. "A Unified Framework for Numerically Inverting Laplace Transforms." INFORMS Journal of Computing, vol. 18.4 (2006): 408-421. Print.

I can only take credit for coding it up in a MATLAB-appropriate way. Here's the MLA citation for the code. You'll need to change the last date to the date that you downloaded it.

McClure, Tucker. Numerical Inverse Laplace Transform. Computer software. Mathworks File Exchange. N.p., 4 Jan. 2013. Web. 8 Aug. 2016.

Li Zhang

### Li Zhang (view profile)

Hi Tucker, I used your package in my paper. How to cite it ?

Fatih Olmez

Christian Reece

H Xue

Will Mansouri

### Will Mansouri (view profile)

Hi tucker

Thank you. Would your inverse laplace result in a solution that can be used as a starting condition and still maintain the same solution?

Mohamed Yassin OUKILA

### Mohamed Yassin OUKILA (view profile)

Hi Tucker,

Thank you very much for the help. I have just read your answer and I it helped me a lot.

Mohamed

Günter Pfeifer

### Günter Pfeifer (view profile)

Doesn't work very well with
periodic functions like:

F1 = @(s) 1 / (s * (1 + exp(-s)));
or
F1 = @(s) (1 - exp(-s) .* (s + 1)) ./ (s.^2 .* (1 - exp(-s)));

Yang

### Yang (view profile)

I would like to compute the inverse laplace transform of 1/(s-1i), which is exp(1i*t). But the programs are not working for this problem. Please help!

Deepak Ramaswamy

Lee

Tucker McClure

### Tucker McClure (view profile)

Hi Mohamed,

No, this is for continuous time only. However, Dr. Dan Ellis of Columbia University has an example of a numerical inverse z-transform written in MATLAB located here: http://www.ee.columbia.edu/~dpwe/e4810/matlab/s10/html/eval_z_transf.html

Note that this type of inversion is notoriously tricky to do numerically, as it requires very precise numbers. Working with the Symbolic Toolbox allows you to request arbitrary precision (e.g., 64 digits of precision).

Hope that helps!

- Tucker

Mohamed Yassin OUKILA

### Mohamed Yassin OUKILA (view profile)

Can we apply these functions to a discrete function?
Thank you :)

abdo mecha

### abdo mecha (view profile)

THAANKS

##### MATLAB Release Compatibility
Created with R2012b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux