用Matlab求贝塞尔函数的根
clear
clc
R=1;
maxv = 5;
maxs = 5;
j= zeros(maxv, maxs);%用于存放第一类贝塞尔函数的根,同一行阶数相同,列数表示第几个根
incr = 4.0;
for v=0:maxv-1
h = v+1.9*v^(1/3)+1;
if (v==0)
j(v+1,1) = fzero(@(x)besselj(v,x),2);
else
j(v+1,1) = fzero(@(x)besselj(v,x),h);
end
for s=2:maxs
j(v+1,s) = fzero(@(x)besselj(v,x),j(v+1,s-1)+incr);
end
end
j
maxv1 =5;
maxs1 = 5;
jd= zeros(maxv1, maxs1);%用于存放导数的根
incr1 = 3.0;
for v1=0:maxv1-1
h1 = v1+2;
if (v1==0)
jd(v1+1,1) = fzero(@(x)besseld(v1,x),3);
else
jd(v1+1,1) = fzero(@(x)besseld(v1,x),h1);
end
for s=2:maxs1
jd(v1+1,s) = fzero(@(x)besseld(v1,x),jd(v1+1,s-1)+incr1);
end
end
jd
lanmda=zeros(1,maxs*maxv+maxs1*maxv1);
for m=1:maxs
for n=1:maxv
lanmda((m-1)*maxs+n)=2*pi*R/j(m,n);
end