why dblquad can not be used to evaluate the bessel function of the second kind bessely
Afficher commentaires plus anciens
Hi All,
I like to calculate the double integral of Bessel function as
clear
clc
a=0;
b=2;
syms x y
A= dblquad(@(x, y) -abs(x-y).*bessely(1, abs(x-y)), a, b, a, b);
where the error is noted as
Warning: Infinite or Not-a-Number function value encountered.
when i take the quad of Bessel function as
clear
clc
a=0;
b=2;
syms x
A= quad(@(x, y) -abs(x).*bessely(1, abs(x)), a, b);
The results is OK!
Anyone know what is the problem with my dblquad? Thank you a lot.
Réponse acceptée
Plus de réponses (1)
Mike Hosea
le 6 Fév 2012
Integrate using QUAD2D and put the singularity on the boundary.
>> f = @(x,y)-abs(x-y).*bessely(1,abs(x-y))
f =
@(x,y)-abs(x-y).*bessely(1,abs(x-y))
>> A = quad2d(f,0,2,@(x)x,2) + quad2d(f,0,2,0,@(x)x)
A =
2.81899103740708
5 commentaires
David Zhang
le 6 Fév 2012
Mike Hosea
le 7 Fév 2012
QUAD2D integrates over "planar regions" that are defined by a <= x <= b and c(x) <= y <= d(x). The planar region is the "support". The integral that is performed is a double integral. DBLQUAD can only integrate over rectangular regions a <= x <= b and c <= y <= d. QUAD2D is better than DBLQUAD on most problems.
Mike Hosea
le 9 Fév 2012
Maybe I misunderstood your question. If you mean, "How do I solve problems like this in in higher dimensions?" then the only answer I have for you is to nest QUAD2D and/or QUADGK using the arrayfun function. This is difficult, but I believe I have supplied codes in my other answers to evaluate triple integrals using QUADGK with QUAD2D, and maybe I have even supplied code to evaluate a 4-D integral nesting QUAD2D with QUAD2D. Clearly this will get very expensive very fast and may not be practical in more than a 3 or 4 dimensions.
David Zhang
le 19 Fév 2012
Mike Hosea
le 23 Fév 2012
Use QUADGK and here again, put the singularity on the boundary: a = quadgk(f,-2,0) + quadgk(f,0,2)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!