View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Mittag-Leffler function

4.7 | 35 ratings Rate this file 46 Downloads (last 30 days) File Size: 2.74 KB File ID: #8738 Version: 1.2

Mittag-Leffler function


Igor Podlubny (view profile)


17 Oct 2005 (Updated )

Calculates the Mittag-Leffler function with desired accuracy.

| Watch this File

File Information

This is a MATLAB routine for evaluating the Mittag-Leffler function with two parameters (sometimes also called generalized exponential function).

The Mittag-Leffler function with two parameters plays an important role and appears frequently in solutions of fractional differential equations (i.e. differential equations containing fractional derivatives).

MLF(alpha,beta,Z,P) is the Mittag-Leffler function E_{alpha,beta}(Z) evaluated with accuracy 10^(-P) for each element of Z.

Update 2009-03-25:
(1) Now Z can also be a two-dimensional array.
(2) Addressed the issue reported by Li Jackie. It was caused by rounding errors during computations.

Update 2012-09-07:
(1) Addressed the potential issue reported by Brian Bigler.
(2) Code clean up.


This file inspired Global Pade Approximation Of The Mittag Leffler Function.

MATLAB release MATLAB 6.0 (R12)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (42)
23 Feb 2017 Xuhuan Wang

Thank you very much!

Comment only
30 Dec 2016 Themmman


24 Oct 2016 Matthew

Thanks for contributing this.

I think there is an issue for alpha<1 with beta=1.

I have only tested it for the above cases and for real z, but this code shows the problem:

z = linspace(0,10,100);

As a previous comment says, this code is based on a paper by Gorenflo et al. Direct evaluation of equation 23 using a numerical integration routine gives the correct results and is reasonably efficient.

Comment only
10 Oct 2016 ahmed elakhdar

Thank you for your useful contribution.

30 Jun 2016 Pantelis Sopasakis

I would like to understand the math behind this implementation? Is there some reference for further information? Thank you in advance.

Comment only
30 Jun 2016 Pantelis Sopasakis

08 Jun 2016 zsczsc48

Thank you very much for your useful contribution.

12 May 2016 Iphy kelvin

I need help urgently.i need the math-lab function name for Mainardi function and as for the Mittag-Leffler function name,when i used it in mathlab 2013.the software said undefined function 'mlf'.
what should i do??

Comment only
21 Mar 2016 zhu

zhu (view profile)

05 Feb 2015 jukkrit kluabwang

Thank you very much for your useful contribution.

31 Jan 2015 Amr AbdelAty

Thanks professor igor for this valuable file.
I noticed a little discontinuity near t=12 when executing this code

>> t=0:0.001:50;
>> y=mlf(0.5,0.5,-t,5);
>> plot(t,y)

I will be very thankful for any advice.

21 Oct 2014 kaber

kaber (view profile)

17 Jun 2014 Pritesh Shah

It is very useful function for implementation of fractional calculus in relativity.
Need small help, E^(3)(0.3,1.9)(-t^0.3).

How do I calculate this function?

17 Feb 2014 qi xiang

03 Jul 2013 lksdfskl

very good.

02 Jul 2013 Elias Wegert

Positive: The routine computes the function in regions where the Taylor series fails.
Negative: Computations are relatively slow and not completely reliable, for example, alpha=1/2, beta=1 and z near the imaginary axis (probably directly on the imaginary axis) yield completely wrong results (see the phase portrait at

Comment only
23 Jun 2013 Zhuo Li

Zhuo Li (view profile)

28 May 2013 Ondrej

Ondrej (view profile)

I have one more remark. I found this article on internet:

and it seemed to me that your code is based on it. Probably a reference in your code to this paper (or the theory behind your code), can help other people understand your code.

28 May 2013 Igor Podlubny

Igor Podlubny (view profile)

To Ondrej: : we assume alpha > 0, beta > 0. Thank you for the comment on the exception.

Comment only
22 May 2013 Ondrej

Ondrej (view profile)

I am not sure, but there might be potential bugs in case a=0.

If a=0, code jumps to the end, at tries to evaluate variable "e"..which does not exist.
Also, as far as I know, case a=0, b=1, corresponds to sum of geometric progression (1/(1-z)), therefore a=0, should be allowed in the code.

Comment only
13 Sep 2012 wang xiao

Thank you!

12 Sep 2012 Andrey

Andrey (view profile)

Thank you Igor!

20 Aug 2012 Brian

Brian (view profile)

This function is excellent and exactly what I needed!

One potential bug:
The compound inequality on line 36 (1<=alf<2) always evaluates to true (1<=alf evaluates to a logical 0 or 1, which is always less than 2). I don't think this was the statement's intent.

20 Aug 2012 Brian

Brian (view profile)

08 Aug 2012 Jinwen

Jinwen (view profile)

12 Jan 2012 Roberto Garrappa

It is a very robust code and is very useful in several applications. An excellent work. It is a reference for practical computation in Fractional Calculus.

31 Mar 2011 udita katugampola

Thanks for the contribution to the field of Fractional Calculus.

20 Nov 2009 Maxwelldemon ??

The code is very very helpful. Thanks a lot. However, there exists a problem:
When 1<alfa<2, beta>1, the returned value has a jump when the variable z is around -170. When alfa=1.5, I tried beta=1.5, 2.5, 3.5, the jump always happens around -170.
Furthermore, in the code, I can't find computations for the case 1<alfa<2, when z>floor(20/(2.1-alfa)^(5.5-2*alfa)).
I will be very thankful for any advice.

12 Apr 2009 Haitao Qi

Thanks. It's the best.

25 Mar 2009 Ivo Petras

Ivo Petras (view profile)

Thanks. It works excellent.

10 Oct 2008 tamer nabil

14 Mar 2008 Li Jackie

Why there exists complex value in the numerical result of the Mittag-Leffler function when the variable (named z) is real?
Recently I used the programe MLF.m to compute the Mittag-Leffler function in Matlab. But I had a problem that there existed complex value in the numerical result of the Mittag-Leffler function. Since the interval of z (variable of function) I setted is a subset of real space, I can't explain why appearence of complex value of Mittag-Leffler function. Could someone give me some advice? Hope it will not delay you too much time. Thanks.

25 Apr 2007 Assabaa Mohamed

can you send me a complete code for simulating the fractional oscillator,I need it urgently to confirm an idea. thanks a lot

23 Mar 2007 Eduardo Cuesta

This function has been useful to me and taking an overview to the code, this seems to be vere, very fine.

09 Oct 2006 Vamsi Krishna

That was very very helpful sir.Please let me know the algorithm you have used or any reference paper which contains the properties you have used.Please let me know if you have written the code for MLF with three parameters.

29 Sep 2006 mervyn yian

may i know do u have a complete code for simulating the fractional oscillator........i need in urgently. thanks a lot

16 Feb 2006 Enrico Scalas

It is a nice and useful algorithm.

15 Feb 2006 saeed alavi

thank a lot .

21 Dec 2005 Alvaro Cartea

It is great to have someone like Podlubny put the code out. This saves people in the field a great deal of time!!

21 Nov 2005 Wang Shaowei

Thank Prof.Igor Podlubny!

12 Nov 2005 Lingzao zeng

Excellent.Thanks a lot

17 Oct 2005 YangQuan Chen

Thanks for the contribution.

18 Oct 2005

Keywords were truncated by the system during file submission. One can enter many characters in the 'Keywords' field of the file submission form, but it appears that the FileExchange system accepts only first 70 characters in the "Keywords" field.

25 Mar 2009 1.1

(1) Now Z can also be a two-dimensional array.
(2) Addressed the issue reported by Li Jackie. It was caused by rounding errors during computations.

07 Sep 2012 1.2

Addressed the potential issue reported by Brian Bigler. Code clean up.

Contact us