Bessel Functions
Bessel Functions
Matlab Code :
% Plot Bessel Functions of the First, Second and Third Kinds
clear ;
close all ;
clc ;
disp('Plot Bessel Functions of the First and Second Kinds for ν = 0, 1, 2, 3 and 4') ;
disp(' ') ;
figure(2) ;
fplot(bessely(0:4 , x) , 'lineWidth' , 4) ;
set(gca , 'lineWidth' , 3.5 , 'fontSize' , 16 , 'fontWeight' , 'bold') ;
xlabel('x' , 'fontSize' , 19) ;
Page 1 of 6
ylabel('Y_{\nu}(x), \nu in [0 , 4] ' , 'fontSize' , 19) ;
title('The First Five Bessel Functions of the Second Kind for \nu = 0, 1, 2, 3 and 4' ,
'fontSize' , 20) ;
legend(' Y_{0}(x)' , ' Y_{1}(x)' , ' Y_{2}(x)' , ' Y_{3}(x)' , ' Y_{4}(x)' , 'fontSize' , 19 ,
'Location','Best') ;
grid on ; grid minor ;
axis xy ; box on ;
axis([0 10 -1 0.6]) ;
disp('Bessel Function of the Third Kind (Hankel Function)') ;
disp(' ') ;
figure(3) ;
% Create a grid of values for the domain.
[X , Y] = meshgrid(-4 : 0.025 : 4 , -2 : 0.025 : 2) ;
% Calculate the Hankel function over this domain and generate the modulus contour plot.
H = besselh(0 , 1 , (X + 1i*Y)) ;
contour(X , Y , abs(H) , 0 : 0.2 : 3.2 , 'lineWidth' , 3.5) ;
set(gca , 'lineWidth' , 3.5 , 'fontSize' , 16 , 'fontWeight' , 'bold') ;
hold on ;
% In the same figure, add the contour plot of the phase.
contour(X , Y , rad2deg(angle(H)) , -180 : 10 : 180 , 'lineWidth' , 3.5) ;
hold off ;
xlabel('x' , 'fontSize' , 19) ;
ylabel('y' , 'fontSize' , 19) ;
title('Contour Plot of The Bessel Function of the Third Kind (Hankel Function)' , 'fontSize'
, 20) ;
grid on ; grid minor ;
axis xy ; box on ;
axis([-4 4 -2 2]) ;
Page 2 of 6
disp('Plot the real and imaginary parts of the Hankel function of the second kind and
examine their asymptotic behavior.') ;
disp(' ') ;
disp('Calculate the Hankel function of the second kind :') ;
disp('H0(2)(x) = J0(x) − iY0(z) in the interval [0.1 , 25].') ;
disp(' ') ;
k=2;
nu = 0 ;
x = linspace(0.1 , 25 , 200) ;
H = besselh(nu , k , x) ;
figure(4) ;
plot(x , real(H) , x , imag(H) , 'lineWidth' , 3.5) ;
set(gca , 'lineWidth' , 3.5 , 'fontSize' , 16 , 'fontWeight' , 'bold') ;
hold on ;
M = sqrt(real(H).^2 + imag(H).^2) ;
plot(x , M , '--' , 'lineWidth' , 3.5) ;
xlabel('x' , 'fontSize' , 18) ;
ylabel('Real and Imaginary Parts of H_{0}^{(2)}(x)' , 'fontSize' , 18) ;
title('The Asymptotic Behavior of the Magnitudes of the Real and Imaginary Parts of
H^{(2)}_{0}(x)' , 'fontSize' , 20) ;
grid on ; grid minor ;
axis xy ; box on ;
Page 3 of 6
legend(' J_{0}(x)' , ' Y_{0}(x)' , ' Magnitude of (H^{(2)}_{0}(x)) : | H^{(2)}_{0}(x) | =
√[J_{0}(x)]^2 + [Y_{0}(x)]^2' , 'fontSize' , 18 , 'Location' , 'Best') ;
(𝟐) (𝟐) 𝟐
(𝟐) 𝟐
𝐌𝐚𝐠𝐧𝐢𝐭𝐮𝐝𝐞 𝐨𝐟 (𝐇𝟎 (𝒙)) = √[𝐑𝐞𝐚𝐥 (𝐇𝟎 (𝒙))] + [𝐈𝐦𝐚𝐠𝐢𝐧𝐚𝐫𝐲 (𝐇𝟎 (𝒙))]
(𝟐) (𝟐)
𝐌𝐚𝐠𝐧𝐢𝐭𝐮𝐝𝐞 𝐨𝐟 (𝐇𝟎 (𝒙)) = |𝐇𝟎 (𝒙)| = √[𝐉𝟎 (𝒙)]𝟐 + [𝐘𝟎 (𝒙)]𝟐
(𝟐)
.𝐇𝟎 (𝒙) : التي تكشف عن السلوك التقاربي لمقادير األجزاء الحقيقية و التخيلية للدالة
Page 4 of 6
Page 5 of 6
Page 6 of 6