Initializing a value at the beginning of a Feedback loop in SIMULINK

14 ビュー (過去 30 日間)
Sreekanth Nandakumar
Sreekanth Nandakumar 2019 年 7 月 31 日
Hello all,
I am attaching a simplified version of a SIMULINK model with a feed back loop. In the model, the variable 'x' is involved in a feedback loop. x is a 3X1 Matrix with values x = [0.9 ; 0 ; 0] which I have initialized inside the MATLAB fcn block. This is a state equation and the x gets updated after a series of equations. Now how will I use the updated value in the next time step ? Even though the updated value is feedbacked into the input, the initial value of x inside the MATLAB fcn is still used in the calculation as the initializing comes inside the fcn. How to solve this issue ?
Feedback.png
  2 件のコメント
Renato SL
Renato SL 2019 年 7 月 31 日
編集済み: Renato SL 2019 年 7 月 31 日
Can you show us what happens inside fcn ?
Sreekanth Nandakumar
Sreekanth Nandakumar 2019 年 8 月 2 日
It is a generic model to just ask how to do it. The original model can't be posted here due to confidentiality.

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

採用された回答

Raj
Raj 2019 年 7 月 31 日
Instead of initializing the value of 'x' inside MATLAB function, try the following:
1) Instead of directly feeding x1 at x (which is not correct by the way as it becomes an algebraic loop!) pass x1 through a unit delay block before connecting at x.
2) Double click on the unit delay block and set your initial conditions as the value you have mentioned in your question. Now this value will be used only during first cycle of execution to compute the first output which will be fed back to compute the second output during second execution cycle and so on.
  1 件のコメント
Sreekanth Nandakumar
Sreekanth Nandakumar 2019 年 8 月 2 日
Hello Raj, Thank you very much for the solution. It worked as of now. Now I need to complete the model and check whether I get the desired result.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by