필터 지우기
필터 지우기

NaN output is coming why?

조회 수: 2 (최근 30일)
SHARAD KUMAR UPADHYAY
SHARAD KUMAR UPADHYAY 2019년 3월 5일
댓글: 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