"Runtime Error: Call to MATLAB function aborted: Domain error. To compute complex results, make at least one input complex, e.g. 'power(complex(a),b)'."
이전 댓글 표시
Hello, I'm trying to solve the following system in Simulink. I have some coder.extrinsic('intpolyval') into the Embeeded Matlab Function to deal with function handles I need to use while exchanging variables between functions, for instance:
function sol=intpolyval(coeff,minx,maxx)
sol=integral(@(x) polyval(coeff,x),minx,maxx);
end
While i try to run my model I get the error in debugger:
"Runtime Error: Call to MATLAB function aborted: Domain error. To compute complex results, make at least one input complex, e.g. 'power(complex(a),b)'."
This only happens when there is a loop in the Simulink model, while the model is simple- everything goes all right. Did anyone have similiar problems? How have u worked arround it?
채택된 답변
추가 답변 (1개)
shulin hu
2018년 10월 28일
편집: Walter Roberson
2020년 7월 7일
hello,have you solve it?I have the similar problem:
Call to matlab function aborted:Domain error,To compute complex results from real x,use 'log(complex(x))'
function y = fcn(u1,u2,t) %#codegen
if t>0.4
y=-2.875*t/log(1-(2.875*u1/u2));
end
댓글 수: 2
jose luis huayanay villar
2020년 7월 7일
hello,have you solve it?I have the similar problem:
An error occurred while running the simulation and the simulation was terminated
Caused by:
- Domain error. To compute complex results, make at least one input complex, e.g. 'power(complex(a),b)'.
Walter Roberson
2020년 7월 7일
function y = fcn(u1,u2,t) %#codegen
if t>0.4
y=-2.875*t/log(complex(1-(2.875*u1/u2)));
end
The original code would have had problems when u1 > u2 / 2.875 so that the log() would have been of a negative number.
카테고리
도움말 센터 및 File Exchange에서 Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!