Azzera filtri
Azzera filtri

NaN output is coming why?

2 visualizzazioni (ultimi 30 giorni)
SHARAD KUMAR UPADHYAY
SHARAD KUMAR UPADHYAY il 5 Mar 2019
Commentato: dpb il 5 Mar 2019
%% 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 Commento
dpb
dpb il 5 Mar 2019
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...

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by