MATLAB: Indefinite integrals of bessel function

bessel functionintegral

I have this function that has bessel functions which has to be integrated from infinity to 0 and plot the graph between Fy and r.
Matlab returns NaN as output.
mu=4*pi*10^-7;
M=0.891*10^6;
R=5*10^-3;
s=10*10^-3;
t=5*10^-3;
syms q
r=linspace(-10*10^-3,10*10^-3,20)
func=@(q) 4*pi*M^2*mu*R^2*(besselj(1,(r.*q/R)).*besselj(1,q).^2.*sinh(q.*t/(2*R)).^2.*exp(-q.*s/R));
F=integral(func,inf,0)
plot(r,F)
%Edited:-Forgot to place F in plot.

Best Answer

you need ArrayValued option for integrate()