Main Content

Max step size

Description

Specify the largest time step that the solver can take.

Category:Solver

Settings

Default:auto

  • For the discrete solver, the default value (auto) is the model's shortest sample time.

  • For continuous solvers, the default value (auto) is determined from the start and stop times. If the stop time equals the start time or isinf, Simulink®chooses0.2seconds as the maximum step size. Otherwise, it sets the maximum step size to

    h max = t s t o p t s t a r t 50

  • ForSineandSignal Generatorsource blocks, Simulink calculates the max step size using this heuristic:

    h max = min ( t s t o p t s t a r t 50 , ( 1 3 ) ( 1 F r e q max ) )

    where F r e q max is the maximum frequency (Hz) of these blocks in the model.

Tips

  • Generally, the default maximum step size is sufficient. If you are concerned about the solver missing significant behavior, change the parameter to prevent the solver from taking too large a step.

  • Max step size determines the step size of the variable-step solver.

  • If the time span of the simulation is very long, the default step size might be too large for the solver to find the solution.

  • If your model contains periodic or nearly periodic behavior and you know the period, set the maximum step size to some fraction (such as 1/4) of that period.

  • In general, for more output points, change the refine factor, not the maximum step size.

Dependencies

This parameter is enabled only if the solverTypeis set toVariable-step.

Command-Line Information

Parameter:MaxStep
Type:character vector
Value:any valid value
Default:'auto'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

Related Topics