How can I make definite integral to Bessel function in the interval from 0 to infinite

1 view (last 30 days)
i used the commend 'guadgk' to make definite integral to Bessel function in the interval from 0 to infinite, the result turns out to be that it's not a good way to solve it.
the code:
clc;
clear;
f=@(q)BESSELJ(0,q);
n=quadgk(f,0,inf)
the result displayed in the commend window:
Warning: Reached the limit on the maximum number of intervals in use.
Approximate bound on error is 1.0e+007. The integral may not exist, or
it may be difficult to approximate numerically. Increase MaxIntervalCount
to 712 to enable QUADGK to continue for another iteration.
> In quadgk>vadapt at 317
In quadgk at 216
In test_4 at 4
n =
1.3759e+007
what should i do ?

Answers (1)

Mike Hosea
Mike Hosea on 1 Jul 2013
I'm not sure I understand the problem. The answer is 1, so use 1 instead of quadgk(f,0,inf). However, if you are concerned about the results over a finite range of 0 to b, I would not be concerned unless b is large. The improper integral of f, or the integral over a large interval, is just one of those problems that needs to be approached analytically or with a highly specialized numerical method tailored in some sense to that particular problem.

Community Treasure Hunt

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

Start Hunting!