## 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 is `inf`, Simulink® chooses `0.2` seconds as the maximum step size. Otherwise, it sets the maximum step size to

`${h}_{\mathrm{max}}=\frac{{t}_{stop}-{t}_{start}}{50}$`

• For Sine and Signal Generator source blocks, Simulink calculates the max step size using this heuristic:

`${h}_{\mathrm{max}}=\mathrm{min}\left(\frac{{t}_{stop}-{t}_{start}}{50},\left(\frac{1}{3}\right)\left(\frac{1}{Fre{q}_{\mathrm{max}}}\right)\right)$`

where $Fre{q}_{\mathrm{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 solver Type is set to `Variable-step`.

### Command-Line Information

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

### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact