What block do I have to use in Simulink to input parameters with the sim command?

1 回表示 (過去 30 日間)
Moritz Burghardt
Moritz Burghardt 2016 年 8 月 11 日
コメント済み: Pawel Ladosz 2016 年 8 月 11 日
Hello!
I have a simulink modell that has constant values as input. It looks a lot like this:
I would like to use the "sim" command to start the modell, while also entering Parameters. So the command should look like this:
SimOut = sim('model', 'p_R_soll', 1500, 't_B', 1.5);
However when I enter the command I get the error message:
"block_diagram does not have a parameter named 'p_R_soll'"
How can I enter parameters using the sim command?
Thanks!

回答 (1 件)

Pawel Ladosz
Pawel Ladosz 2016 年 8 月 11 日
just set the parameters to matlab workspace, prior to running sim command, Simulink should automatically see them and use them. So for example parameter p_R_soll should be defined in command window as:
p_R_soll=1500;
and after you define all parameters just run
SimOut = sim('model');
  2 件のコメント
Moritz Burghardt
Moritz Burghardt 2016 年 8 月 11 日
編集済み: Moritz Burghardt 2016 年 8 月 11 日
So whats the purpose of the "SimOut = sim('model', 'par1', value1, 'par2', value2,...);" structure? It is described in the documentation: http://de.mathworks.com/help/simulink/ug/using-the-sim-command.html
Pawel Ladosz
Pawel Ladosz 2016 年 8 月 11 日
Hi Moritz,
I believe this is to define simulink preferences (for example time step size)

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

カテゴリ

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