An error occurred while running the simulation and the simulation was terminated
2 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone, I am using matlab simmulink to simulate the system. However, I am having the following 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)'.
0 件のコメント
回答 (1 件)
Walter Roberson
2024 年 11 月 28 日
You have a MATLAB Function block in the lower left. It has s0 as input and ds0 as output. The 4th line of code for it is
ds0=(s0.^(q0/p0));
where q0/p0 does NOT happen to be an integer.
That code has problems when s0 is negative. Negative raised to a fractional power gives a complex result, but you have not specifically marked the inputs as being complex.
In practice, s0 does go negative.
You could try
ds0=(complex(s0).^(q0/p0));
and that will remove the error about complexity. However you will then get errors about how the complexity of ds0 does not match the back-propagated complexity of the signal. It is doubtful that your Position Tracking Controller is prepared to handle complex input.
2 件のコメント
Walter Roberson
2024 年 11 月 29 日
The file chap7_3plant.m uses
T1=abs(x1)^(q/p)*sign(x1);
T2=abs(x1)^(q/p-1)*sign(x1);
%...
T1=abs(x2)^(p/q)*sign(x2);
T2=abs(x2)^(2-p/q)*sign(x2);
Notice the abs(). Your implementation for ds0 has s0.^(q0/p0) without the abs()
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!