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');
model command executes a specific phase
of the simulation of a Simulink® model whose name is
The command's last argument (
flag) specifies the
phase of the simulation to be executed. See Simulation Phases in Dynamic Systems for
a description of the steps that Simulink software uses to simulate
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 these requirements.
All states in the model must be built-in non-bus data types. For a discussion on built-in data types, see About Data Types in Simulink.
If you are using vector format to specify the state,
this command can access only non-complex states of
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.
The state variable
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
Outputs of the model at time step
Derivatives of the continuous states of the model at
Discrete states of the model at time
Time step, specified as real double in scalar format.
State vector, specified as real double in structure or vector format.
Inputs, specified as real double in vector format.
String that indicates the simulation phase to be executed:
The following command executes the compilation phase of the
that comes with Simulink software.
vdp(, , , 'compile')
The following command terminates the simulation initiated in the previous example.
vdp(, , , 'term')
You must always terminate simulation of the model by invoking
the model command with the