Warning: Infinite or Not-a-Number value encountered.
8 次查看(过去 30 天)
显示 更早的评论
Dear all,
I am facing the warning (Infinite or Not-a-Number value encountered.) in my following code. Due to the Nan/Inf values, the output of my complete code is erratic. Please help me solve the issue, thanks. Body of affected portion of code is as under:
clear all
clc
AB=0.34;
j=1;
x(1)=(15*AB);
z(1)=0;
while z <= 0.3
j=j+1;
z(j)=z(j-1)+0.020;
i=1;
while x(i)<=(15*AB) && x(i)>=(-15*AB)
i=i+1;
x(i)=x(i-1)-(AB/10);
f1=@(l)exp(-(x(i)/1000-l.*cos(0.2663)).*(1.67./ (2.*4.18e-6))).*(besselk(0,((1.67./(2.*4.18e-6)).*sqrt((x(i)/1000-l.*cos(0.2663)).^2+(z(j)/1000+l.* sin(0.2663)).^2))));
% Lower limit of integral
a=0.000001;
% Upper limit of integral
b=AB/1000;
integral1(i)=integral(f1,a,b);
end
end
3 个评论
Mathieu NOE
2021-3-3
ok so the problem is find why f1 has infinite values - at which iteration does it appear ?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Special Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!