Numerical error in simulink

4 ビュー (過去 30 日間)
JGP
JGP 2023 年 11 月 20 日
コメント済み: Paul 2023 年 11 月 20 日
Often, I've encountered errors like the one above when using Simulink's add or product block.
When I check each signal, I don't see any division by 0. Sometimes it's just a matter of replacing the + with a -. What is the problem?

採用された回答

Paul
Paul 2023 年 11 月 20 日
Hi Junghyo Kim,
Your question references "division by 0" but the error message has nothing to do with division by zero.
The error message clearly sates that the problem occurs at T = 0.128 and that, at that time, the solver can't solve an algebraic loop in the model. See Algebraic Loop Concepts if you're not familiar and the Related Topics at the bottom of that page as a starting point.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 11 月 20 日
編集済み: Walter Roberson 2023 年 11 月 20 日
When the error is at time 0, as is the case in your example, then the problem is almost always incorrect initial values.
Consider for example if you have a derivative block. At time 0, no time has elapsed so far so the "natural" outcome right at time 0 is either 0 change divided by 0 seconds (0/0 giving NaN) or else some finite change divided by 0 seconds (giving +/- infinity). So for derivative blocks and similar it is crucial that you define the initial conditions.
Likewise if you have any calculation in your model that divides something by clock time, the calculation is in trouble at time 0.
  1 件のコメント
Paul
Paul 2023 年 11 月 20 日
The error occurred at T = 0.128, not T = 0, so it's not an issue with initial conditions at the start of the simulation.
Also, the Derivative Block does not work that way; it always outputs 0 as its initial output. As far as I know, the Derivative block doesn't have an initial condition to specify.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSources についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by