Frank Moses
Frank Moses

Reputation: 127

Is there a built-in function in Matlab for calculating following integral?

I need to find the value of the following integral:

enter image description here

Does anybody know if there is a built-in function in Matlab for calculating this?

Upvotes: 1

Views: 203

Answers (1)

TroyHaskin
TroyHaskin

Reputation: 8401

In reading through the referenced paper, which was later expanded into a book, I don't see any direct equality expressed for the author's definition of the generalized incomplete gamma function that can be replicated using the Matlab's Elementary Math library. The authors actually use the IMSL Fortran subroutine QDAGI to directly integrate and generate their table of values (sadly, only given to five decimal places). Therefore, the most direct route in evaluating such a function is to use integral.

The raw incomplete generalized gamma function can be written inline as

iggamma = @(x,alpha,b) integral(@(t) (t+x).^(alpha-1) .* exp(-(t+x)-b./(t+x)),0,Inf,'ArrayValued',true)

where I shifted t to t+x such that the lower bound was always 0 and an array-valued x could be passed. The table in the book scales this raw function by a term involving what the authors call a modified Bessel function of the third kind but what the Mathworks calls a modified Bessel function of the second kind besselk (because that's not confusing at all). The scaled version would be:

iggammas = @(x,alpha,b) iggamma(x,alpha,b) ./ ( 2*b.^(alpha/2) .* besselk(alpha,2*sqrt(b)))

The scaled version matches most of the values I checked to four decimal places with a few disagreeing on the fifth; however, I would chalk this up to differences in rounding and integration tolerance parameters.

Upvotes: 2

Related Questions