필터 지우기
필터 지우기

An error occurred while running the simulation and the simulation was terminated Caused by: Domain error. To compute complex results from real x, use 'sqrt(complex(x))'.

조회 수: 2 (최근 30일)
I dont know why my model has this error because in my code,i have never ust SQRT function.Hope all you help me,especially Sebastian.

채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 30일
o =0.5;
R = anpha*sige1+beta*sige2*t;%2x1
s = dq +R;%2x1
s1 = s(1,1);
s2 = s(2,1);
sigs1 = [(s1^o)*sign(s1);(s2^o)*sign(s2)];
s1^0.5 is sqrt(s1), but your s1 or s2 are negative.
Your code already expects that they might be negative: otherwise it would not have the multiplication by sign() as it would have assumed that the sign is constant.
sigs1 = [(abs(s1)^o)*sign(s1);(abs(s2)^o)*sign(s2)];
  댓글 수: 1
chuyen hoangcao
chuyen hoangcao 2020년 12월 31일
Thank you so much for helping me.I add abs for all power expression includeing s,e.After that,it also appears another error about derivative 1 is not finite...It took me a little time to change into fixed-step,and it worked.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by