0% found this document useful (0 votes)
15 views

Bessel Functions

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Bessel Functions

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Graphs of Bessel Functions Using Matlab Program

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(' ') ;

% Define the domain as a symbolic variable


syms x y ;

% Plotting the Bessel Functions :


figure(1) ;
fplot(besselj(0:4 , x) , 'lineWidth' , 4) ;
set(gca , 'lineWidth' , 3.5 , 'fontSize' , 16 , 'fontWeight' , 'bold') ;
xlabel('x' , 'fontSize' , 19) ;
ylabel('J_{v}(x), \nu in [0 , 4] ' , 'fontSize' , 19) ;
title('The First Five Bessel Functions of the First Kind for \nu = 0, 1, 2, 3 and 4' , 'fontSize' ,
20) ;
legend(' J_{0}(x)' , ' J_{1}(x)' , ' J_{2}(x)' , ' J_{3}(x)' , ' J_{4}(x)' , 'fontSize' , 19 ,
'Location','Best') ;
grid on ; grid minor ;
axis xy ; box on ;
axis([0 10 -0.5 1.1]) ;

figure(2) ;
fplot(bessely(0:4 , x) , 'lineWidth' , 4) ;
set(gca , 'lineWidth' , 3.5 , 'fontSize' , 16 , 'fontWeight' , 'bold') ;

Page 1 of 7
xlabel('x' , 'fontSize' , 19) ;
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 ;

Page 2 of 7
axis([-4 4 -2 2]) ;

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) ;

disp('Plot the real and imaginary parts of the function.') ;


disp(' ') ;

disp('In the same figure, plot the linear combination :') ;


disp('M = √J0²(x) + Y0²(x) , which reveals the asymptotic behavior of the magnitudes of the
real and imaginary parts of H0(2)(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) ;

Page 3 of 7
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 ;
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') ;

: ‫مهام البرنامج السابق‬


ν = 0, 1, 2, 3 and 4 : ‫رسم دوال بيسل من النوع األول والثاني للقيم‬ 
)‫دالة بيسل من النوع الثالث (دالة هانكل‬ 
.‫رسم األجزاء الحقيقية والتخيلية لدالة هانكل من النوع الثاني و فحص سلوكها التقاربي‬ 
x ∈ [ 0.1 ,25 ] : ‫حساب دالة هانكل من النوع الثاني في نطاق الفترة‬ 
(2 )
H 0 ( x )=J 0 ( x )−i Y 0 ( x )
(2 )
: ‫ في نفس الشكل مع رسم التركيبة (التوليفة) الخطية التالية‬H 0 ( x ) ‫رسم األجزاء الحقيقية والتخيلية للدالة‬ 

√[ ] [ ]
2 2
Magnitude of ( H 02 ( x ) ) = Real ( H 02 ( x )) + Imaginary ( H 02 ( x ) )
( ) ( ) ( )

( ) ( )

Magnitude of ( H 02 ( x ) ) =|H 02 ( x )|= [ J 0 ( x ) ] + [ Y 0 ( x ) ]
2 2

. H (02 ) ( x ) : ‫التي تكشف عن السلوك التقاربي لمقادير األجزاء الحقيقية و التخيلية للدالة‬

Matlab Code Results :


Plot Bessel Functions of the First and Second Kinds for ν = 0, 1, 2, 3 and 4
Bessel Function of the Third Kind (Hankel Function)
Plot the real and imaginary parts of the Hankel function of the second kind and examine
their asymptotic behavior.
Calculate the Hankel function of the second kind :
H0(2)(x) = J0(x) − iY0(z) in the interval [0.1 , 25].
Plot the real and imaginary parts of the function.
In the same figure, plot the linear combination :M = √J0²(x) + Y0²(x) , which reveals the
asymptotic behavior of the magnitudes of the real and imaginary parts of H0(2)(x).

Page 4 of 7
Page 5 of 7
Page 6 of 7
Page 7 of 7

You might also like