Integral of bessel function returns all zeros
3 次查看(过去 30 天)
显示 更早的评论
besselfunc = @(x) besselk(5/3,x);
for n = 1:length(l)
xmin = 4*pi*Rc/(3*l(n)*gamma^3); % lower bound integral
K(n) = integral(besselfunc,xmin,Inf); %integral
end
I am trying to compute the integral of a Bessel function for all values of an array.
The issue is that the integral function always returns zero, so that K(n) is just an array of zeros. I have tried with other more simple functions instead of a Bessel function and it all works. I have also plotted the Bessel function and it seems correct. So what is going wrong here?
The formula for xmin contains some parameters but seems to work so disregard it.
Thanks for any help!
0 个评论
采纳的回答
John D'Errico
2020-9-11
It is a really bad idea to use gamma as a variable name because you are now stepping on the name of a very useful function in MATLAB.
Regardless, we cannot tell you when you did, since you never give the value for that variable, nor for Rc or the vector l.
Odds are some of those variables are such that the lower limit of integration is relatively large. It need to be too huge for that integral to be zero anyway.
Consider that:
besselfunc(100)
ans =
4.7214e-45
besselfunc(1000)
ans =
0
What is the numerical integral of a function that is zero or effectively so over the entire domain of the integral? Even if the interval is infinite in width, integral will return zero.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bessel functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!