Indefinite integrals of bessel function

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.

4 件のコメント

Walter Roberson
Walter Roberson 2021 年 1 月 5 日
plot(r,func(r))
Note that all you do with the integral is display its value.
Walter Roberson
Walter Roberson 2021 年 1 月 5 日
The output of integral is a scalar unless you used 'ArrayValued', but your r is a vector.
David Goodmanson
David Goodmanson 2021 年 1 月 6 日
Hi Rahul,
Compared to the expression you posted, it looks func is missing a factor of epsilon. But a much more serious issue is, what happened to the factor of 1/q?
Rahul Gandhi
Rahul Gandhi 2021 年 1 月 6 日
Hey David,
Thank you for pointing that out. I should have uploaded or just copied my m file rather then typing it here( I must have edited for like 5 times I guess).Epsilon is just +1 or -1, so no issue,but 1/q is needed. I have computed and taken care of 1/q in my system and it gives a plot of same profile as Walter has shown. Thank you again, David and Walter for response

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2021 年 1 月 5 日

0 投票

you need ArrayValued option for integrate()

2 件のコメント

Rahul Gandhi
Rahul Gandhi 2021 年 1 月 5 日
Thank you Walter for quick response. Also the hyperbolic sine function is not giving output for integral, so I used series(first three terms) of Sinh(x)^2. It is correct way?
Walter Roberson
Walter Roberson 2021 年 1 月 5 日
mu=4*pi*10^-7;
M=0.891*10^6;
R=5*10^-3;
s=10*10^-3;
t=5*10^-3;
r=linspace(-10*10^-3,10*10^-3,20)
r = 1×20
-0.0100 -0.0089 -0.0079 -0.0068 -0.0058 -0.0047 -0.0037 -0.0026 -0.0016 -0.0005 0.0005 0.0016 0.0026 0.0037 0.0047 0.0058 0.0068 0.0079 0.0089 0.0100
syms q
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 = vpaintegral(func(q), q, inf, 0);
plot(r,F, 'b*-')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeBessel functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by