登录论坛

查看完整版本 : [MATLAB基础] 两个函数相乘为什么结果是NaN啊??求助


jiwangting
2011-04-26, 13:13
[t,h]= meshgrid(0.0001:0.0001:0.0008,0.005:0.005:1);
x1=exp(1250*h).*erfc(0.5*(h+1250*t)./sqrt(t));

结果显示X1中一半是NaN~~为啥呢。是因为exp(1250*h)超出了double的范围吗?
如果是,那matlab有没有更大容量的数据类型呢?
求各位大侠指点!!

jiwangting
2011-04-26, 18:51
哪位好心人深深援手啊~
;)

libralibra
2011-04-27, 06:04
通过findNaN的那行(114)和前一行(113)比较,的确是exp(1250*h)溢出了

>> exp(1250*h(114,:))
ans =
Inf Inf Inf Inf Inf Inf Inf Inf
>> exp(1250*h(113,:))
ans =
1.0e+306 *
5.2539 5.2539 5.2539 5.2539 5.2539 5.2539 5.2539 5.2539