double integral infinite limits
21 ビュー (過去 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!