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!