Updating Initial Conditions from last calculated values

3 ビュー (過去 30 日間)
Ismaeel
Ismaeel 2017 年 2 月 26 日
コメント済み: Walter Roberson 2017 年 2 月 26 日
I am trying to find a way to update the initial conditions (x0=[y1,y2,y3,y4,y5]) needed for fsolve in Simulink using Matlab Function user-defined block. The initial values are defined inside the block as a numerical vector. I want the last calculated values of the block's output to be considered as its new initial values. I see fsolve solves the problem but for only some starting iterations. Any ideas to update these values? Thanks

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 2 月 26 日
Make the guess a signal (or set of signals) that you input into the function block, and route the outputs back into those. You should be able to initialize them somehow.
I am not sure of the best way to initialize something like this. I know that initialization blocks exist but I have not seen how to use them. I know one way is to use a switch block that would take a constant as one input and the feed-back values as another input and use a compare on the time as the signal to decide which of the two to use. There might be a much better way than this.
  2 件のコメント
Ismaeel
Ismaeel 2017 年 2 月 26 日
There is an Algebraic Loop problem when route back the signals from the output to the block's input.A time comparator switch is a good idea but unfortunately, it did not work for me.

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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by