double integral infinite limits
조회 수: 20 (최근 30일)
이전 댓글 표시
is there any idea how can i calculate the integral of this function with infinite limits -00,+00
function Fr = int_frustration_function2(x,Kt,i)
Fr = dblquad(@(v,u)fun2(v,u,x,Kt,i),-Inf,Inf,-Inf,Inf);
end
where for fun2
function fun2 = fun2(v,u,x,Kt,i)
global SNR sigma_a q
k= 1./(sqrt(2.*pi.*((sigma_a./q).^(2))));
temp1=((log(v)+((sigma_a./q).^(2))).^(2)); temp2=(2.*((sigma_a./q).^(2))); temp3=exp(-temp1./temp2);
temp4=((B1N(Kt,0,u,i).*SNR.*x)./4);
fun2 = k.*exp(-(u.^2)).*(besseli(0,0).*exp(-temp4.*(v.^(2))).*temp3);%
end
please help!!!
댓글 수: 0
채택된 답변
Mike Hosea
2011년 8월 26일
This is easy to modify if you want c and/or d to be a function handle, like for QUAD2D. Also, it should be easy to add tolerances or whatever options you would like.
function y = mydblquad(fun,a,b,c,d)
% Double integral using QUADGK.
innerintegral = @(x)arrayfun( ...
@(xi,y1i,y2i)quadgk(@(y)fun(xi*ones(size(y)),y),y1i,y2i), ...
x,c*ones(size(x)),d*ones(size(x)));
y = quadgk(innerintegral,a,b);
>> mydblquad(@(x,y)1./(1+x.^4+y.^4),-inf,inf,-inf,inf)
ans =
5.824747385361142
댓글 수: 6
Gautam
2012년 8월 10일
편집: Gautam
2012년 8월 10일
This was a very helpful post as I was wondering how I would achieve a double integration where the limits could be Inf. Following on Mike's post, I just wanted to confirm that the following modification to Mike's code to handle the case where the upper limit of the inner integral (the integration variable being y) is a function of x:
function y = mydblquad(fun,a,b,c,d) innerintegral = @(x) arrayfun(... @(xi,yli,y2i)quadgk(@(y)fun(xi*ones(size(y)),y),yli,y2i),... x,c*ones(size(x)),feval(d,x)); y = quadgk(innerintegral,a,b);
I tried the above and it seems to work fine. Any comments would be appreciated.
- Gautam
Mike Hosea
2012년 8월 10일
One can indeed extend that method to use arbitrary lower and upper limit functions on the inner integral. I should note that the answer I gave above is somewhat old now. If you have the 2012a release of MATLAB you can use INTEGRAL2 "out of the box".
추가 답변 (1개)
the cyclist
2011년 8월 25일
There is some discussion here that may help you:
Be sure to look at the comments, too, particular the ones from Walter.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!