| Simulink® | ![]() |
[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 (flag) argument 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 is intended to allow linear analysis and other M-file program-based tools to run a simulation step by step, gathering information about the model's states and outputs at each step. It is 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.
sys | Vector of model size data:
|
x0 | Vector containing the initial conditions of the system's states |
str | 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. |
ts | An m-by-2 matrix containing the sample time (period, offset) information |
outputs | Outputs of the model at time step t. |
derivs | Derivatives of the continuous states of the model at time t. |
dstates | Discrete states of the model at time t. |
t | Time step |
x | State vector |
u | Inputs |
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')
Note You must always terminate simulation of the model by invoking the model command with the 'term' command. Simulink software does not let you close the model until you have terminated the simulation. |
![]() | load_system | modeladvisor | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |