Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem with big number in exponetial

Subject: problem with big number in exponetial

From: george veropoulos

Date: 20 Jul, 2011 07:53:10

Message: 1 of 2

Dear friends
im have a matlab function

function f=energy_new(x)

format long g;
% length in nm

D=10.;
L=5.;
L1=5.;
V0=0.858;% in ev
%V0 is 60% of energy gap
%GaAs in region 1 3 5
%InAs in region 2 and 4

m_0=0.51;%free electron mass in Mev
%%%% EFFECTIVE MASS
m1_star=0.067.*m_0;
m2_star=0.0278.*m_0;
m3_star=m1_star;
m4_star=m2_star;
m5_star=m1_star;

h_bar=1.0;% in fermi unit's
%k vector
k_1=(10.^9).*sqrt(2.*m1_star.*(x-V0))/h_bar;
k_5=k_1;
k_3=k_1;
k_2=(10.^9).*sqrt(2.*m2_star.*x)/h_bar;
k_4=k_2;
%%%%% MATRIX ELEMENT'S
A11=-exp(i.*k_2.*(D+L));
A12=0;
A13=0;
A14=0;
A15=exp(-i.*k_1.*(D+L));
A16=-exp(i.*k_2.*(D+L));
A17=0;
A18=0;
%
A21=(i.*k_2./m2_star).*exp(i.*k_2.*(D+L));
A22=0;
A23=0;
A24=0;
A25=(i.*k_1./m1_star)*exp(-i.*k_1.*(D+L));
A26=(-i.*k_2./m2_star)*exp(-i.*k_2.*(D+L));
A27=0;
A28=0;

A31=exp(i.*D.*k_2);
A32=-exp(-i.*k_3.*D);
A33=0;
A34=0;
A35=0;
A36=exp(-i.*k_2.*D);
A37=-exp(-i.*k_3.*D);
A38=0;

A41=(i.*k_2./m2_star).*exp(i.*k_2.*D);
A42=-(i.*k_3./m3_star).*exp(i.*k_3.*D);
A43=0;
A44=0;
A45=0;
A46=-(i.*k_2./m2_star).*exp(-i.*k_2.*D);
A47=(i.*k_3./m3_star)*exp(-i.*k_3.*D);
A48=0;

A51=0;
A52=exp(-i.*k_3.*D);
A53=-exp(-i.*k_4.*D);
A54=0;
A55=0;
A56=0;
A57=exp(i.*k_3.*D);
A58=-exp(i.*k_4.*D);

A61=0;
A62=(i.*k_3./m3_star)*exp(-i.*k_3.*D);
A63=-(i.*k_4./m4_star)*exp(-i.*k_4.*D);
A64=0;
A65=0;
A66=0;
A67=-(i.*k_3./m3_star)*exp(i.*k_3.*D);
A68=(i.*k_4./m4_star)*exp(i.*k_4.*D);

A71=0;
A72=0;
A73=exp(-i.*k_4.*(D+L1));
A74=-exp(-i.*k_5.*(D+L));
A75=0;
A76=0;
A77=0;
A78=exp(i.*k_4.*(D+L1));

A81=0;
A82=0;
A83=(i.*k_4./m4_star).*exp(-i.*k_4.*(D+L1));
A84=-(i.*k_5./m5_star).*exp(-i.*k_5.*(D+L1));
A85=0;
A86=0;
A87=0;
A88=-(i.*k_4./m4_star).*exp(k_4.*(D+L1));

A=[A11 A12 A13 A14 A15 A16 A17 A18;.../
    A21 A22 A23 A24 A25 A26 A27 A28;.../
    A31 A32 A33 A34 A35 A36 A37 A38;.../
    A41 A42 A43 A44 A45 A46 A47 A48;..../
    A51 A52 A53 A54 A55 A56 A57 A58;.../
    A61 A62 A63 A64 A65 A66 A67 A68;.../
    A71 A72 A73 A74 A75 A76 A77 A78;.../
    A81 A82 A83 A84 A85 A86 A87 A88 ];

%solve(det(A), 'E')
%%%%% magnitude of det
f=abs(det(A));


i m trying to find a value energy_new(0.001)
the resultas is NaN
When i removed the factor 10^9 from k quantity
the results is finite !!
What happen please tell me

Thank you very much !!

Subject: problem with big number in exponetial

From: Steven_Lord

Date: 20 Jul, 2011 13:29:25

Message: 2 of 2



"george veropoulos" <veropgr@yahoo.gr> wrote in message
news:j061h6$q5i$1@newscl01ah.mathworks.com...
> Dear friends
> im have a matlab function

*snip*

> i m trying to find a value energy_new(0.001)
> the resultas is NaN
> When i removed the factor 10^9 from k quantity the results is
> finite !!
> What happen please tell me

You can't represent numbers that large in double precision; attempting to do
so causes that value to overflow to Inf. You will need to use the
variable-precision arithmetic functionality in Symbolic Math Toolbox or
something similar.

See the second column on the second page of this article for more
information.

http://www.mathworks.com/company/newsletters/news_notes/pdf/Fall96Cleve.pdf

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us