I have my system model in MATLAB simulink. Now I want to design my controller using matlab script(code). I want to run my simulink model from script using 'sim' command. After every instant I want to use the updated values from the system model to update my control algorithm. I want to run my simulink model by using the updated values after previous instant as initial conditions for the next running instant.

Suppose, I want to run the system for total duration of 10 minutes. After every 0.5 minute I want to update my controller based on system response.

Now for every 0.5 minute I want to run the simulink model from script using 'sim' and after every 0.5 minute run I want my simulink model to retain the values at the end of previous run so that these values can be used as initial conditions for the next run.

How can I do that?

More Namita Boruah's questions See All
Similar questions and discussions