Execute particular phase of simulation of model
[sys,x0,str,ts] = model(,,,'sizes'); [sys,x0,str,ts] = model(,,,'compile'); outputs = model(t,x,u,'outputs'); derivs = model(t,x,u,'derivs'); dstates = model(t,x,u,'update'); model(,,,'term');
The model command executes a specific phase of the simulation of a Simulink® model whose name is model. The command's last argument (flag) specifies the phase of the simulation to be executed. See Simulating Dynamic Systems for a description of the steps that Simulink software uses to simulate a model.
This command ignores the effects of state transitions and conditional execution. Therefore, it is not suitable for models which have such logic. Use this command for models which can be represented as simple dynamic systems. Such systems should meet requirements which include the following:
All states in the model must be non-complex states of data type double. No other states can be accessed using this command.
There is minimal amount of state logic (Stateflow, conditionally executed subsystems etc.)
The models are not mixed-domain models. That is, most blocks in the model are built-in Simulink blocks and do not include user-written S-functions or blocks from other Sim* products)
For models which do not comply with these requirements, using this command can cause Simulink to produce results which can only be interpreted by further analyzing and simplifying the model.
This command is also not intended to be used to run a model step-by-step, for example, to debug a model. Use the Simulink debugger if you need to examine intermediate results to debug a model.
Vector of model size data:
Vector containing the initial conditions of the system's states
Vector of names of the blocks associated with the model's states. The state names and initial conditions appear in the same order in str and x0, respectively.
An m-by-2 matrix containing the sample time (period, offset) information
Outputs of the model at time step t.
Derivatives of the continuous states of the model at time t.
Discrete states of the model at time t.
String that indicates the simulation phase to be executed:
This command executes the compilation phase of the vdp model that comes with Simulink software.
vdp(, , , 'compile')
The following command terminates the simulation initiated in the previous example.
vdp(, , , 'term')