Fixed-step size (fundamental sample time)
Step size for fixed-step solver
Model Configuration Pane: Solver
When you use a fixed-step solver, you can specify the size of the fixed step the solver takes during simulation.
To enable this parameter, set Periodic sample time constraint to
auto | positive scalar double
By default, the fixed step size is
auto. The software determines the appropriate step size for the simulation according to these rules:
If the model includes periodic discrete sample times, the software chooses a step size equal to the greatest common divisor of the periodic sample times in the model. This step size ensures that the simulation takes a step for every sample time in the model.
If the model does not include periodic discrete sample times and specifies a finite sample time, the solver chooses a step size that divides the simulation into 50 equal steps.
If the model does not include periodic sample times and specifies the stop time as
Inf, the simulation uses a step size of
If the model has no periodic sample times and uses Sine Wave or Signal Generator blocks, the software also considers the maximum frequency for the periodic signals generated by the source blocks. The step size is calculated to ensure that the step size is no smaller than one third of the minimum period of a periodic signal in the model, determined as the inverse of the maximum frequency .
For a simulation with a finite stop time, if one third of the minimum period is smaller than the step size calculated to divide the simulation into fifty even steps, the simulation uses the step size determined using the maximum frequency.
For a simulation with infinite stop time, if one third of the minimum period is smaller than
0.2, the simulation uses the step size determined using the maximum frequency.
When the model is configured to start the simulation from an initial state specified as a
Simulink.op.ModelOperatingPointobject, the software uses the fixed step size stored in the
When you allow the solver to determine the fixed step size, you can see the value that the solver determines several ways:
Once the model is compiled, the Solver information window and tooltip provide information about the solver and fixed step size. To see the solver information, click or pause on the solver information string in the lower-right corner of the Simulink® Editor.
Several actions result in compiling the model, including updating the block diagram and simulating the model.
When you use the
get_paramfunction to get the value of the
FixedStepparameter, the function returns
'auto'if the parameter value is specified as
auto. Once the model is compiled, you can programmatically access the fixed step size chosen by the software using the
CompiledStepSizeargument for the
fixedStepSize = get_param("mdlName","CompiledStepSize");
When you return simulation results as a single simulation output object, the metadata in the
Simulink.SimulationOutputobject includes the fixed step size used in the simulation. The fixed step size is stored as part of the model information in the
Simulink.SimulationMetadataobject, in the solver information.
simMetadata = getSimulationMetadata(out); simModelInfo = simMetadata.ModelInfo; simSolverInfo = simModelInfo.SolverInfo; simFixedStep = simSolverInfo.FixedStepSize;
- positive scalar double
To use a value other than
auto, specify the fixed step size in seconds as a double-precision value.
The specified step size must be less than or equal to the smallest sample time in the model and must be a factor of every sample time in the model.
When you configure a referenced model to use a local solver, the step size for the local solver must be an integer multiple of the step size for the parent solver. For more information, see Use Local Solvers in Referenced Models.
The table summarizes recommended values for this parameter based on considerations related to code generation.
|Type: string | character vector
'auto' | positive scalar number
|Type: string | character vector
|Value: positive scalar number
Introduced before R2006a