Getting error in MEX file execution
1 次查看(过去 30 天)
显示 更早的评论
I'm doing parameter tuning for an equation of state using the genetic algorithm function (ga). When I run the equation of state file as I coded it in MATLAB, it works fine. When I compile and package the file as a MEX file, it gives me the following error:
Error using
coder.internal.error (line
17)
Domain error. To compute
complex results from real x,
use 'log(complex(x))'.
Error in log (line 13)
coder.internal.error('Coder:toolbox:ElFunDomainError',mfilename);
Error in EOSfunction (line 552)
logPHI = MUres_kT - log(Z);
What could be causing this? I have checks to make sure that Z is always real and non-negative, so log(Z) should never be causing a problem.
2 个评论
Walter Roberson
2016-10-26
As an experiment, just above that logPHI line, add
assert(Z > 0);
and see what happens.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!