NaN output is coming why?

2 次查看(过去 30 天)
SHARAD KUMAR UPADHYAY
评论: dpb 2019-3-5
%% I am getting output as NaN, where I am using this type of program
function F_half=F_D_I(Aplus,t)
fun=@(x) (x.^(-1/2)./(exp(x-Aplus./t)+1))
F_half=integral(fun,0,inf,'ArrayValued',true,'RelTol',1e-4)
end
%%
function FT=wint(Aplus,m,Q,hh,EF,n,KB,T)
t=KB.*T./EF
muu=t.*log(exp(1./t)-1)
Aplus=@(w)APM(muu,hh,w,EF,Q)
fun=@(w)4.*EF.*Q.^2./(pi.^2.*n.*m.*KB.*T.^3).*F_D_I(Aplus(w),t).^2./sinh(hh.*w./(2.*KB.*T)).^2
FT=integral(fun,0,inf,'ArrayValued',true,'RelTol',1e-4)
end
%% when i run the program upto here then program is ok and no problem upto here.
%% but when i go as
function phi1=potential(KF,Q,L,d,e,ep,qTF)
phi1=4*pi.*e.^2./ep.*G_12(KF,Q,L,d)./((1-2*qTF.*G_11(KF,Q,L)).*(1-2*qTF.*G_11(KF,Q,L))-4*qTF.^2.*G_12(KF,Q,L,d).^2)
end
%%
function output=Main_drag(Aplus,m,Q,hh,EF,n,KB,T,KF,L,d,e,ep,qTF)
f=@(Q) 2.*KF.*Q.*potential(KF,Q,L,d,e,ep,qTF).^2.*wint(Aplus,Aminus,m,Q,hh,EF,n,KB,T)
output=integral(f,0,inf,'ArrayValued',true,'RelTol',1e-4)
end
%% to run this i use
X=Main_drag(Aplus,m,Q,hh,EF,n,KB,T,KF,L,d,e,ep,qTF)
%% I got the results in X=NaN, why please solve it.
  1 个评论
dpb
dpb 2019-3-5
NaN comes from things like 0/0 and when you try to integrate [0, inf] probably your functional is something of that sort or other similar expression at extremes.
Test your anonymous function over limiting values...

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by