Can we find derivative of bessel functions in matlab directly?

7 ビュー (過去 30 日間)
Javeria
Javeria 2025 年 7 月 3 日
移動済み: Torsten 2025 年 7 月 3 日
For example if i have x can be any value. I need to know how we can find the derivative directly in MATLAb. for m=0,1.

採用された回答

Torsten
Torsten 2025 年 7 月 3 日
移動済み: Torsten 2025 年 7 月 3 日
You can compute it symbolically first and insert the result as a numerical expression in your code.
syms x
diff(besselj(0,x),x)
ans = 
diff(besselj(1,x),x)
ans = 

その他の回答 (1 件)

David Goodmanson
David Goodmanson 2025 年 7 月 3 日
編集済み: David Goodmanson 2025 年 7 月 3 日
Hi Javeria,
Here is a function that produces J'm(x) for integer m.
function y = besseljd(n,x,opt)
% derivative of bessel function of integer order.
% input s is optional.
% if s = 1, result is scaled by exp(-abs(imag(z))), same as with besselj.
% default is 0, no scaling.
% note that there is another available expression besides the one used below:
% y = besselj(n-1,x,s) - n*besselj(n,x,s)./x;
%
% y = besseljd(n,x,s);
if nargin == 3
s = opt;
else
s = 0;
end
y = -besselj(n+1,x,s) + n*besselj(n,x,s)./x;
% get rid of nans, integer order
if n==1
y(x==0) = 1/2;
else
y(x==0) = 0;
end
  2 件のコメント
Javeria
Javeria 2025 年 7 月 3 日
Can we make use of only one line which calculate the derivative of bessel functions just we only switch cases i.e mode m= 0, 1.
David Goodmanson
David Goodmanson 2025 年 7 月 3 日
I'm not sure exactly what you mean but if scaling is not needed then the single line
y = -besselj(n+1,x) + n*besselj(n,x)./x;
works unless x = 0. If x = 0 then you still need the four last lines in the code above.

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

カテゴリ

Help Center および File ExchangeBessel functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by