Change Simulink block parameter during simulation

24 ビュー (過去 30 日間)
Óscar Poveda
Óscar Poveda 2021 年 3 月 18 日
コメント済み: Óscar Poveda 2021 年 3 月 25 日
Hi!
I am trying to update a block parameter of simulink during the simulation. In my case, I want to update the parameter "Lookahead distance (m)" depending on the current velocity of my vehicle.
First i thought using a MATLAB Function block, whose input is the current velocity and then a variable called "lookahead" is calculated. Then i wrote this variable in the "Pure Pursuit" block, so i thought that changing this value inside the MATLAB function would have changed the value of the variable inside the block. Instead, it's value is constant during all simulation (the value predefined in the MATLAB workspace before running the simulation).
So, there is a way to change a block parameter in Simulink in each time step?
Thank you all,
Óscar

採用された回答

Kiran Felix Robert
Kiran Felix Robert 2021 年 3 月 22 日
編集済み: Kiran Felix Robert 2021 年 3 月 22 日
Hi Oscar,
Refer this answer thread for details about updating Simulink block parameters at run time. The reason why the variable is not updated is also clearly explained in this answer.
Also refer this MathWorks blog page about similar issue. This explains the difference between Block Parameter and Simulink Signals.
  1 件のコメント
Óscar Poveda
Óscar Poveda 2021 年 3 月 25 日
Thank you so much! It was so helpful.
Óscar.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by