Variable Step between only two values

Hi, I have to run a simulation with a solver step size of 1e-13 for the first 20 or 30 points, and then switch the step size value to 1e-12 for the rest of simulation. How can I tell this to Simulink? In Variable Step Options I only can set the max and min step.
Thanks in advance.

 採用された回答

Naman Chaturvedi
Naman Chaturvedi 2018 年 9 月 10 日

0 投票

You can use the sim command to simulate the model from a start time, to a stop time and with a time step. Eg:- If your simulation time is 20 sec wherein, the first half is run with 1e-13 and the second with 1e-12 step size.
>>a=sim('try1','StartTime','0','StopTime','10','FixedStep','1e-13');
>>b=sim('try1','StartTime','10+0.1','StopTime','20','FixedStep','1e-12');
Combined outputs of a and b will give you the desired outputs. Change the #points to time and you will be able to use the code.

1 件のコメント

Unknown
Unknown 2018 年 9 月 10 日
This is exactly what I've done, and it works. Thanks anyway.

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

その他の回答 (0 件)

カテゴリ

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

製品

リリース

R2018a

質問済み:

2018 年 9 月 6 日

コメント済み:

2018 年 9 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by