why dblquad can not be used to evaluate the bessel function of the second kind bessely
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (1)
Mike Hosea
am 6 Feb. 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 Kommentare
David Zhang
am 6 Feb. 2012
Mike Hosea
am 7 Feb. 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
am 9 Feb. 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
am 19 Feb. 2012
Mike Hosea
am 23 Feb. 2012
Use QUADGK and here again, put the singularity on the boundary: a = quadgk(f,-2,0) + quadgk(f,0,2)
Kategorien
Mehr zu Numeric Solvers finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!