Simulinks problems to acos

I'm computing an acos in a matlab function in my simulink problems and I got the error
Domain error. To compute complex results from real x, use 'acos(complex(x))'.
To avoid this I defined the argument of the acos as arg = max(min(arg,1),-1);
however when I do this my model becomes extremely slow to run. A simulation of 10000s that would take <1s to run now would take an hour. Any suggestions?

1 件のコメント

John D'Errico
John D'Errico 2020 年 11 月 15 日
Rather than using the max/min thing to catch arguments that are outside the range [-1,1], I would invest some time in learning why your equations seem to exceed those limits. Don't try to patch the problem, when that event makes little sense to ever arise. Fix the problem, don't apply a bandaid.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

質問済み:

2020 年 11 月 15 日

コメント済み:

2020 年 11 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by