# Numerical Integration of two variable @(x,t) respective to t (quadgk)

11 views (last 30 days)
Tifani Utami on 10 Aug 2016
Answered: Steven Lord on 10 Aug 2016
Dear Community, I am facing a problem with my integration result. I have this function I have tried several ways. I do it in separate way. from 0 to 1 and 1 to inf . For 0 to 1 is already done with numerical Riemman Sum approximation. now, All I need is to integrate from 1 to inf.
funintscg1 = @(x,t) (exp(-x./t)./t).*(1-exp(-x./t)).^(M-1)
funintscg1 =
@(x,t)(exp(-x./t)./t).*(1-exp(-x./t)).^(M-1)
>>
??? Error using ==> quadgk>finalInputChecks at 463
Supported classes are 'double' and 'single'.
Error in ==> quadgk>evalFun at 345
finalInputChecks(x,fx);
Error in ==> quadgk>f2 at 375
[y,too_close] = evalFun(t2t);
[fx,too_close] = f(x);
Error in ==> quadgk at 205
For second attempt, I use syms integration x, t with int(funintscg1,t,1,inf) function
syms x t
funintscg1 =(exp(-x./t)./t).*(1-exp(-x./t)).^(M-1)
funintscg1 =
(1/exp(x/t) - 1)^2/(t*exp(x/t))
intscg = int(funintscg1,t,1,inf)
Warning: Explicit integral could not be found.
intscg =
int((1/exp(x/t) - 1)^2/(t*exp(x/t)), t = 1..Inf)
Do you guys have any idea how to overcome this problem?
Thank you so much for your help. Hope you all have a good day.

Steven Lord on 10 Aug 2016
The integral function can compute an integral where one or both of the endpoints of the region over which to integrate are infinite. Your attempt with quadgk was close.
You need to evaluate funintscg1 in the anonymous function. Right now what that anonymous function returns is not the value of your integrand, but the anonymous function that is the integrand itself.
intscg1 = integral(@(t)funintscg1(5, t),0,inf) % using x = 5