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

조회 수: 5 (최근 30일)
Tifani Utami
Tifani Utami 2016년 8월 10일
답변: Steven Lord 2016년 8월 10일
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)
>>
intscg1 = quadgk(@(t)funintscg1,1,inf)
??? 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);
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.

답변 (1개)

Steven Lord
Steven Lord 2016년 8월 10일
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

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by