Search code examples
simulinkstate-space

Is it possible to set initial state to a simulink model to do simulations?


Consider that I have built an electrical circuit or any other system at Simulink and to do simulations, Simulink should work in the sense that it builds a state space model of the system, right? If that is the case, is it possible to set an initial condition of this model? And more, is it possible to know what are the state variables of the model built by Simulink?


Solution

  • The Simulink.BlockDiagram.getinitialState method can be used to interrogate the model, and return an appropriate structure giving the current initial value of the states.

    The values in the structure can then be changed and the (new) values used with the model configuration parameters to start at a different initial state. See the doc for a usage example.