Domain error. To compute complex results, make at least one input complex.

조회 수: 10 (최근 30일)
Nguyen Xuan Bo
Nguyen Xuan Bo 2022년 6월 15일
댓글: Mohammad Ali Sharifian 2024년 12월 17일
Hi.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)'.
How can I fix it?
I have attached the Simulink file.
Thank you so much!

답변 (1개)

Walter Roberson
Walter Roberson 2022년 6월 15일
이동: Joel Van Sickel 2023년 4월 27일
Your code is probably trying to take a negative number to a fraction power, which would give you a complex result. If that is what you want to do, then Simulink requires that you give it permission to use complex numbers by converting the input to complex using a call to complex(). And remember to take into account that this may cause output signals to become complex.
If you are not expecting a complex result there, then you need to debug how the input became negative there.
  댓글 수: 2
Joel Van Sickel
Joel Van Sickel 2023년 4월 27일
I can confirm Walter's answer that you are taking a negative number to a fraction of a power. For a model this complex, you should build up the individual pieces and get them working seperately before trying to combine everything.
Mohammad Ali Sharifian
Mohammad Ali Sharifian 2024년 12월 17일
This answer worked. I used abs() command to make it positive.
This problem happens in terminal sliding mode control when you have fractional powers.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by