%MAE82 Bessel Function Project
clear;
close all;

[X,Y] = meshgrid(-1:0.03:1,-1:0.03:1);

% m * n
ZerosOfTheBessleFunctionFirst = [ 2.40483, 5.52008, 8.65373;
                                    3.83171, 7.01559, 10.1735;
                                    5.13562, 8.41724, 11.6198;
                                    6.38016, 9.76102, 13.0152];
                                
m = 3; %m: order
n = 3; %n: nth zero

figure(1)
[Theta,Rho] = cart2pol(X,Y);
Z1 = besselj(m, ZerosOfTheBessleFunctionFirst(m+1,n)*Rho).*cos(m*Theta).*(Rho < ones(size(Rho))); %variable, order

surf(X,Y,Z1);
xlabel('x');
ylabel('y');
title1 = strcat('J_m(Z_m_n*r)*cos(m*theta), m = ', num2str(m), ' n = ', num2str(n));
title(title1); 

figure(2)
Z2 = besselj(m, ZerosOfTheBessleFunctionFirst(m+1,n)*Rho).*sin(m*(Theta)).*(Rho < ones(size(Rho))); %variable, order

surf(X,Y,Z2);
xlabel('x');
ylabel('y');
title2 =strcat( 'J_m(Z_m_n*r)*sin(m*theta), m = ', num2str(m), ' n = ', num2str(n));
title(title2);

