フィルターのクリア

Implementing While loop in Simulink

2 ビュー (過去 30 日間)
Suraj Parasuram
Suraj Parasuram 2021 年 6 月 6 日
回答済み: Jonas 2021 年 6 月 7 日
Hello!
I am basically trying to implement a method for determining the attitude of a satellite in space in Simulink. The method uses a Newton-Raphson scheme to search for the optimum value. I figured out that the While Iterator can be used and have figured that the first line of the below code will basically act as the Initial condition to the While Iterator. I am having a problem trying to figure out the implementation of body of the while loop.
Any help with respect to that will be appreciated. Thanks!
lambda = sum(w); % Shuster1981 and markley1993
last_lambda = 0.0;
while abs(lambda - last_lambda) >= tolerance
last_lambda = lambda;
f = lambda^4 - (a + b)*lambda^2 - c*lambda + constant;
f_dot = 4*lambda^3 - 2*(a + b)*lambda - c;
lambda = lambda - f/f_dot;
end
  1 件のコメント
Ankit
Ankit 2021 年 6 月 7 日
have you tried using While Iterator ?

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

回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 6 月 7 日
Simulink 4 has [While Iterator Subsystem] that can be employed for NR simulation model.

Jonas
Jonas 2021 年 6 月 7 日
https://nl.mathworks.com/help/ecoder/ug/while-loop.html
The documentation demonstrates
  • the While Iterator subsystem
  • and alternatively if you have Stateflow, a Stateflow implementation
  • and finally an embedded MATLAB Function implementation.
Maybe this last option is nice for you since you already have an implementation in MATLAB code.

カテゴリ

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

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by