Helmholtz problem in circular disk
이전 댓글 표시
The following expression 

gives the solution for the Helmholtz problem. On the circular disc with center 0 and radius a. For
the plot in 3-dimensional graphics of the solutions on Matlab for
.
the first row of my data should display the first row of
, and
as "2.4048, 3.8317, 5.1356
, and Why do I have this results at (1,1) and (2,1)? WHat should I have to change?
diska = 1; % Radius of the disk
mmax = 2; % Maximum value of m
nmax = 2; % Maximum value of n
% Function to find the k-th zero of the n-th Bessel function
% This function uses a more accurate method for initial guess
besselzero = @(n, k) fzero(@(x) besselj(n, x), [(k-1)*pi, k*pi]);
% Define the eigenvalue k[m, n] based on the zeros of the Bessel function
k = @(m, n) besselzero(n, m);
% Define the functions uc and us using Bessel functions
% These functions represent the radial part of the solution
uc = @(r, t, m, n) cos(n * t) .* besselj(n, k(m, n) * r);
us = @(r, t, m, n) sin(n * t) .* besselj(n, k(m, n) * r);
% Generate data for demonstration
data = zeros(5, 3);
for m = 1:5
for n = 0:2
data(m, n+1) = k(m, n); % Storing the eigenvalues
end
end
% Display the data
disp(data);
% Plotting all in one figure
figure;
plotIndex = 1;
for n = 0:nmax
for m = 1:mmax
subplot(nmax + 1, mmax, plotIndex);
[X, Y] = meshgrid(linspace(-diska, diska, 100), linspace(-diska, diska, 100));
R = sqrt(X.^2 + Y.^2);
T = atan2(Y, X);
Z = uc(R, T, m, n); % Using uc for plotting
% Ensure the plot is only within the disk
Z(R > diska) = NaN;
mesh(X, Y, Z);
title(sprintf('uc: n=%d, m=%d', n, m));
colormap('jet');
plotIndex = plotIndex + 1;
end
end
채택된 답변
추가 답변 (1개)
According to your code, data(i,j) is a zero of besselj(j-1,x) in the interval [(i-1)*pi i*pi].
So let's plot besselj(1,x) and besselj(2,x) in the interval [0 pi]:
x = linspace(0,pi,100);
hold on
plot(x,besselj(1,x))
plot(x,besselj(2,x))
hold off
grid on
Thus data(1,2) = data(1,3) = 0 is correct.
카테고리
도움말 센터 및 File Exchange에서 Special Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


