Why do I get the message NaN?
이전 댓글 표시
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
Star Strider
2016년 1월 30일
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.
채택된 답변
추가 답변 (1개)
Abhisek Roy
2016년 2월 3일
0 개 추천
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.
카테고리
도움말 센터 및 File Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!