Simulink Reference | ![]() ![]() |
Create or edit simulation parameters and solver properties for the sim
command
Syntax
options = simset(property, value, ...); options = simset(old_opstruct, property, value, ...); options = simset(old_opstruct, new_opstruct); simset
Description
The simset
command creates a structure called options
, in which the named simulation parameters and solver properties have specified values. All unspecified parameters and properties take their default values. It is only necessary to enter enough leading characters to uniquely identify the parameter or property. Case is ignored for parameters and properties.
options = simset(property, value, ...)
sets the values of the named properties and stores the structure in options
.
options = simset(old_opstruct, property, value, ...)
modifies the named properties in old_opstruct
, an existing structure.
options = simset(old_opstruct, new_opstruct)
combines two existing options structures, old_opstruct
and new_opstruct
, into options
. Any properties defined in new_opstruct
overwrite the same properties defined in old_opstruct
.
simset
with no input arguments displays all property names and their possible values.
You cannot obtain or set values of these properties and parameters using the get_param
and set_param
commands.
Parameters
AbsTol
positive scalar {1e-6}
Absolute error tolerance. This scalar applies to all elements of the state vector. AbsTol
applies only to the variable-step solvers.
positive integer {1}
Decimation for output variables. Decimation factor applied to the return variables t
, x
, and y
. A decimation factor of 1 returns every data logging time point, a decimation factor of 2 returns every other data logging time point, etc.
base | {current} | parent
Where to assign variables. This property specifies the workspace in which to assign any variables defined as return variables or as output variables on the To Workspace block.
FinalStateName
string {''}
Name of final states variable. This property specifies the name of a variable in which Simulink saves the model's states at the end of the simulation.
FixedStep
positive scalar
Fixed step size. This property applies only to the fixed-step solvers. If the model contains discrete components, the default is the fundamental sample time; otherwise, the default is one-fiftieth of the simulation interval.
InitialState
vector {[]}
Initial continuous and discrete states. The initial state vector consists of the continuous states (if any) followed by the discrete states (if any). InitialState
supersedes the initial states specified in the model. The default, an empty matrix, causes the initial state values specified in the model to be used.
positive scalar {auto}
Suggested initial step size. This property applies only to the variable-step solvers. The solvers try a step size of InitialStep
first. By default, the solvers determine an initial step size automatically.
1 | 2 | 3 | 4 | {5}
Maximum order of ode15s
. This property applies only to ode15s
.
nonnegative integer {0}
Limit number of output data points. This property limits the number of data points returned in t
, x
, and y
to the last MaxDataPoints
data logging time points. If specified as 0, the default, no limit is imposed.
positive scalar {auto}
Upper bound on the step size. This property applies only to the variable-step solvers and defaults to one-fiftieth of the simulation interval.
OutputPoints
{specified} | all
Determine output points. When set to specified
, the solver produces outputs t
, x
, and y
only at the times specified in timespan
. When set to all
, t
, x
, and y
also include the time steps taken by the solver.
{txy} | tx | ty | xy | t | x | y
Set output variables. If 't'
, 'x'
, or 'y'
is missing from the property string, the solver produces an empty matrix in the corresponding output t
, x
, or y
.
positive integer {1}
Output refine factor. This property increases the number of output points by the specified factor, producing smoother output. Refine
applies only to the variable-step solvers. It is ignored if output times are specified.
positive scalar {1e-3}
Relative error tolerance. This property applies to all elements of the state vector. The estimated error in each integration step satisfies
This property applies only to the variable-step solvers and defaults to 1e-3, which corresponds to accuracy within 0.1%.
Solver
VariableStepDiscrete |
ode45 | ode23 | ode113 | ode15s | ode23s |
FixedStepDiscrete |
ode5 | ode4 | ode3 | ode2 | ode1
Method to advance time. This property specifies the solver that is used to advance time.
SrcWorkspace
{base} | current | parent
Where to evaluate expressions. This property specifies the workspace in which to evaluate MATLAB expressions defined in the model.
Trace
'minstep', 'siminfo', 'compile' {''}
Tracing facilities. This property enables simulation tracing facilities (specify one or more as a comma-separated list):
'minstep'
trace flag specifies that simulation stops when the solution changes so abruptly that the variable-step solvers cannot take a step and satisfy the error tolerances. By default, Simulink issues a warning message and continues the simulation.
'siminfo'
trace flag provides a short summary of the simulation parameters in effect at the start of simulation.
'compile'
trace flag displays the compilation phases of a block diagram model.
{on} | off
Enable/disable location of zero crossings. This property applies only to the variable-step solvers. If set to off
, variable-step solvers do not detect zero crossings for blocks having intrinsic zero-crossing detection. The solvers adjust their step sizes only to satisfy error tolerance.
Examples
This command creates an options structure called myopts
that defines values for the MaxDataPoints
and Refine
parameters, using default values for other parameters.
This command simulates the vdp
model for 10 seconds and uses the parameters defined in myopts
.
See Also
![]() | simplot | simget | ![]() |