double integral infinite limits

22 vues (au cours des 30 derniers jours)
kostas
kostas le 25 Août 2011
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!!!

Réponse acceptée

Mike Hosea
Mike Hosea le 26 Août 2011
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 commentaires
Gautam
Gautam le 10 Août 2012
Modifié(e) : Gautam le 10 Août 2012
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
Mike Hosea le 10 Août 2012
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".

Connectez-vous pour commenter.

Plus de réponses (1)

the cyclist
the cyclist le 25 Août 2011
There is some discussion here that may help you:
Be sure to look at the comments, too, particular the ones from Walter.

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by