error: too large number in context
이전 댓글 표시
Hi there When I run my m file program, I have the following error. My program has a symbol called 'n' which I evaluate numerically. My program has functions I wrote before like 'gain_call'
??? Error using ==> sym.sym>char2sym Error, integer too large in context
Error in ==> sym.sym at 92 S = char2sym(x);
Error in ==> sym.maple at 92 result = sym(result);
Error in ==> sym.exp at 7 Y = maple('map','exp',X);
Error in ==> gain_call at 18 fc=(exp((Ea-Efc)/(K*T))+1)^-1;
Error in ==> gain_input at 45 g3=gain_call(Efc,Efv,freq_j,Eg);
Can anybody help me with this problem. I thought my laptop is not powerful enough to run this program as the error says 'too large number in context'. Is this true??
답변 (1개)
Walter Roberson
2012년 2월 2일
0 개 추천
exp((Ea-Efc)/(K*T)) would produce such a large result that Maple is not able to represent it.
I do not recall what the limit is for Maple; above 10^(10^8) and below 10^(10^9)
댓글 수: 12
omnia
2012년 2월 3일
Walter Roberson
2012년 2월 3일
At the point it stops, what is the value of (Ea-Efc)/(K*T) ?
omnia
2012년 2월 4일
Walter Roberson
2012년 2월 4일
I do not see any 'n' in that expression. Are some or all of the variables symbolic in your gain_input routine? Do you subs() anything in to them before the fc= assignment?
In any case, if you command
dbstop if error
at the MATLAB command line, and you run the program, then when it stops in sym.sym, use the command line command
dbup
until it shows you that you are positioned in gain_call . At that point you should be able to examine the individual variables Ea, Efc, K, and T, and you should be able to evaluate (Ea-Efc)/(K*T)
I speculate that either K or T will be 0 at that point.
omnia
2012년 2월 4일
Walter Roberson
2012년 2월 4일
What does
(Ea-Efc)/(K*T)
calculate out to when the problem occurs?
Possibly vpa() of the expression might turn out to be suggestive.
omnia
2012년 2월 4일
Walter Roberson
2012년 2월 4일
Ah... it _might_ be the case that exp() is having trouble with those large numerators and denominators in rational form, as rational form always tries to work with exact solutions.
Perhaps if you inserted vpa() around the (Ea-Efc)/(K*T) it might work. Just be sure you use enough Digits to be meaningful for your purposes.
omnia
2012년 2월 6일
Walter Roberson
2012년 2월 6일
Ah, and what is vpa((Ea-Efc)/(K*T)) at that point?
omnia
2012년 2월 6일
omnia
2012년 2월 6일
카테고리
도움말 센터 및 File Exchange에서 Common Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!