How to remove singularity of quadl in which integrand is hankel function
显示 更早的评论
Hi, i am using quadl to integrate hankel function in an m file which is further to be passed to fsolve command.
function F=myfunc(kz)
%------Constants-------
L= 4.2;
W=0.396;
b= 5.592;
a=12;
k0= 0.6283;
B1= -2.0726 - 0.0004i;
C1= 0.8285;
E1= 0 + 0.3152i;
G1=-0.2944;
G2= 1.7056;
p= 0.99;
n=2;m=1;
%--- Basic equations---------
kp= sqrt(k0^2-(kz+2*n*pi/p)^2);
kymn1= sqrt(k0^2-(m*pi/a)^2-(kz+2*n*pi/p)^2);
cotterm=(1/kymn1/b).*cot(kymn1.*b);
Sinc_F= (sinc((kz+2*n*pi/p)*W/2))^2;
%----Integral
hank= @(r) besselh(0,2,(kp)*r*L/pi);
int1= @(r) G1*pi*cos(r)-G1.*r.*cos(r)+G2*sin(r);
intanswer= quadl(@(r)(int1(r)).*hank(r),0,pi);
%-----Final Equation ------
F= Sinc_F*(B1*C1*cotterm+E1*intanswer);
In command window i call
>> fsolve(@myfunc,1) % 1 is the initial guess for kz
My problem:
1- for n=0, the equation is solved. For values of n other than 0, e.g. n=2, matlab gives this message. Warning: Maximum function count exceeded; singularity likely. > In quadl at 106
The equation is solved, but the result is not correct (specially the imaginary part of solution which comes to be zero and should not be zero) which i think is due to the above warning.
2- For simplicity i used only single value of n. But actually it should be let's say from -5 -> 5. I have to add up the effect of basic equations and integrals for all values of n, and then put this in final equation to solve. Any suggestions how can i put summation in above equations.
Please help how to resolve this problem. Thanks in anticipation.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!