Hi Kuy
To calculate Bessel functions faster in MATLAB. You can use the besseli function instead of besselj to calculate the modified Bessel functions of the first kind. The besseli function is generally faster than besselj for large arguments.
The reason why besseli is faster than besselj for large arguments is because besseli calculates the modified Bessel functions of the first kind, which have a different mathematical formulation compared to the Bessel functions of the first kind calculated by besselj. The modified Bessel functions have a different asymptotic behavior for large arguments, which allows for more efficient computation.
Here's an example of how you can modify your code to use besseli instead:
Js = zeros(numel(th), numel(q));
tR = sin(th') * R;
for k = 1:numel(q)
Js(:, k) = sum(tn .* besseli(0, q(k) * tR), 2);
end
Adding MATLAB documentation for your reference: