Warning: Infinite or Not-a-Number value encountered.
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Mathieu NOE
il 3 Mar 2021
ok so the problem is find why f1 has infinite values - at which iteration does it appear ?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Special Functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!