Is there a way to change my simulink parameters at a pre-set time during the simulation?

28 views (last 30 days)
Currently I am running Simulink from a script which sets up some parameters for me which are used and considered constant during my simulink simulation. I want to now change a parameter while the simulation is running at some time t=Tswitch. Is there an easy way to do this, maybe by running a Matlab script during the simulink simulation?
Just to be more specific, I want to change an LTI model which I setup in my script to a different LTI model during running.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 6 Apr 2024 at 18:56
There are ways but you are looking for "an easy way".
Typically I would implement this in the model using the Step block. For example, if you want to change the Gain of a LTI system, then you can add a Product block. One input is the output of this LTI system, the other input is the output of this Step block. The before and after value, the timing can all be parameterized.
Whether it is practical depends on which parameter (or parameters) you are switching. You may have to implement this LTI system in different style.
If they are two completely different LTI systems or there are two many parameters to switch, you could use a Step block and a Switch block to switch the output of the two LTI systems.

More Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!