how to automatically configure the sim parameter

when i run the following command in command window, matlab version 2019a
sim('untitled','StartTime','0.0','StopTime','20.0','SolverType','Fixed-step','FixedStep','0.5');
the result shows the model simulation parater not changed, any one knows what's the reason, and how to solve it.

 採用された回答

Nitya Patel
Nitya Patel 2023 年 7 月 7 日

0 投票

You can use the set_param function to set these parameters before running the sim function. Something like below:
set_param('model_name', 'SolverType','Fixed-step');
sim('model_name');
You can set all the parameters individually and run sim at the end.
Documentation:

3 件のコメント

wenchao zhang
wenchao zhang 2023 年 7 月 7 日
thank you, yes, after add the sim('model_name'), the model will run with the new confiuared parameter, but the parameter will turn back to default value when simulation stop, but any way it is ok.
Nitya Patel
Nitya Patel 2023 年 7 月 7 日
You can use the save_system function to save the model after making changes.
wenchao zhang
wenchao zhang 2023 年 7 月 8 日
ok

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgrammatic Model Editing についてさらに検索

製品

リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by