Why do I get the message NaN?
Ältere Kommentare anzeigen
Hello,
I would like to calculate the expression below. But I always get: NaN. I can´t find my mistake.
Can somebody help me?
I4=5.718534314;
I5=-0.001546715453;
Cov__B_C_direct =1125899906842624*exp(I4^(4831891999187463/1125899906842624))*exp(8187485477687969/1715238139330560)*((230090095199403*...
exp(-I4^(4831891999187463/1125899906842624))*exp(-8187485477687969/1715238139330560)*I4^...
(3705992092344839/1125899906842624))/1233348233694652400 - (2558136220007576158378628793351*...
exp(-I4^(4831891999187463/1125899906842624))*exp(-8187485477687969/1715238139330560)*I5*I4^(2580092185502215/1125899906842624))/10681743549394799937933824491520 + ...
(3335311470258831134378888053767*exp(-I4^(4831891999187463/1125899906842624))*exp(-8187485477687969/1715238139330560)*...
I5* I4^(3705992092344839/562949953421312))/10681743549394799937933824491520)
1 Kommentar
Star Strider
am 30 Jan. 2016
When I converted it into a symbolic by putting:
syms I4 I5
between the assignments to those and your equation, I got:
Error using mupadengine/feval (line 163)
Exponent overflow.
I suspect you’re dividing Inf/Inf, which will evaluate to NaN.
This is an observation, not an Answer, so I’m not posting it as one.
Akzeptierte Antwort
Weitere Antworten (1)
Abhisek Roy
am 3 Feb. 2016
0 Stimmen
Hi Max,
It looks like some part of the expression reaches the maximum representable value for a double precision floating point number (which you can find using the function 'realmax'), it overflows, so it is represented as 'inf'. At this point, the numerical result no longer correctly represents the value of the function.
As a workaround for this type of issue try to re-express the function in a different form which does not contain quantities that overflow. In this case, simplify it if possible.
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!