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

11 views (last 30 days)
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 =
intscg1 = quadgk(@(t)funintscg1,1,inf)
??? Error using ==> quadgk>finalInputChecks at 463
Supported classes are 'double' and 'single'.
Error in ==> quadgk>evalFun at 345
Error in ==> quadgk>f2 at 375
[y,too_close] = evalFun(t2t);
Error in ==> quadgk>vadapt at 258
[fx,too_close] = f(x);
Error in ==> quadgk at 205
[q,errbnd] = vadapt(@f2,interval);
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.

Answers (1)

Steven Lord
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.
intscg1 = quadgk(@(t)funintscg1,1,inf)
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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by