← All insights

Simulink · Modelling · Validation

Choosing a Simulink solver: fixed or variable step size?

Fixed or variable step size in Simulink? The right setting depends on the states in the model, the results that must be trustworthy and whether execution on target hardware is planned. This guide presents a traceable selection and validation workflow for typical engineering models.

The article develops the solver question introduced in the German overview of MATLAB and Simulink. The control loop discussed here is an invented teaching scenario. No client models, operational settings or measured project runtimes are disclosed.

Two decisions belong together

Select the solver in the Solver pane of the model configuration parameters. Fixed-step uses a fixed step size; Variable-step adjusts it during simulation. A separate question is whether continuous states need numerical integration or a discrete solver is sufficient. The official MathWorks solver-selection guide [1] explains both classifications.

A purely discrete model does not require integration of continuous states. A continuous plant with a digital controller, however, can contain both continuous and discrete states. “The model includes a discrete block” is therefore not sufficient justification for choosing a purely discrete solver.

Automatic solver selection is a useful first candidate when no validated configuration exists. For a traceable comparison, record the solver actually used and its settings afterwards. An auto setting alone does not sufficiently describe the experiment.

Three starting points for an initial selection

The following table is an engineering starting aid. It does not replace checking the specific model. MathWorks recommends iterative selection based on model behaviour, accuracy and computational cost; its documentation also shows how a variable-step baseline can inform a fixed-step choice. See Choose a Fixed-Step Solver [2].

On narrow screens, scroll the table sideways. With a keyboard, focus the table and use the arrow keys.

Three starting points
TaskFirst candidateNext check
Investigate continuous dynamics offlineSuitable continuous variable-step solverDo tighter tolerances change the decisive results?
Analyse a purely discrete modelDiscrete solver with timing appropriate to the modelAre the intended execution times of all rates respected?
Prepare generated code for a clocked real-time targetFixed-step configuration for the targetAre result quality and execution budget acceptable on the hardware?

A name such as ode45 is not a general quality guarantee. Variable-step continuous solvers differ, among other things, in their suitability for stiff and nonstiff problems. The solver overview [3] describes these differences. If a candidate takes unusually many small steps, investigate model structure and method suitability as well as tolerances.

Solver step size is not controller sample time

A discrete block's sample time describes when it executes. For continuous states, the solver determines numerical integration steps. These are different responsibilities, even though the settings must be compatible. The sample-time documentation [4] explains discrete execution times and the major and minor steps of continuous calculations.

Consider a teaching scenario with a continuous plant, a digital controller and actuator limiting. You want to assess overshoot after a setpoint change. When reducing the solver step size to check accuracy, keep the intended controller sample time unchanged. Otherwise you simultaneously change the numerical calculation and the behaviour of the modelled controller.

For inherited sample times, also inspect the actual compiled rates. I recommend recording important rates and model variants before comparing runs. A convenient change to a block should not silently produce a different timing structure in the model.

A validation plan with a clear comparison question

1. Define the relevant claim before running the experiment

For the control loop described here, relevant quantities might include maximum overshoot, time to enter a previously defined tolerance band and the time at which limiting becomes active. Acceptable deviations must come from the application. This guide does not prescribe universal numerical limits.

Use the same model revision, initial states, input signals, parameters and simulation duration for the compared runs. Log the required signals with their time information. Compare times and quantities using the same evaluation definitions; a smooth curve alone is not a validation criterion.

2. Check a variable-step run for sensitivity

For a suitable variable-step continuous solver, tighter relative or absolute tolerances can provide a countercheck. MathWorks describes this comparison in Check and Improve Simulation Accuracy [5]. Choose the countercheck to suit the state quantities and assess the predefined metrics again.

If the metrics remain similar, that indicates low sensitivity to this change. It proves neither the model's physical correctness nor suitability for every other excitation. A baseline run is a justified comparison basis here, not an automatically exact solution.

3. Compare fixed step sizes on the same task

For a fixed-step candidate, I recommend investigating several admissible step sizes, including a smaller countercheck. The changed step size must remain compatible with the model's timing structure. Record solver, step size, metrics and computational cost for each run.

The usual explicit continuous fixed-step solvers have no built-in error control. Their accuracy depends substantially on method and step size, as described in Fixed-Step Solvers in Simulink [6]. A simulation completing without an error message therefore does not establish that the step size is fine enough.

Do not select solely by the fastest runtime. If a coarser setting changes the peak relevant to the decision or produces a different event time, assess that deviation against the engineering requirements. Only then can the computational saving be judged meaningfully.

4. Examine switching and zero crossings separately

Discontinuities can require additional numerical work. Zero-crossing detection helps locate such events; very frequent events can slow simulation or cause it to stop. The MathWorks documentation [7] demonstrates this behaviour and the available algorithms.

When problems occur, first investigate the involved blocks and the expected switching behaviour. Disabling diagnostics or ignoring events should not merely serve to finish a run faster. Assess the effect of a change using the event sequence and relevant outputs.

Fixed-step alone does not guarantee real-time capability

Hardware execution adds a time budget to the numerical question: the calculation must finish on time. For Simulink Real-Time, MathWorks describes CPU overload when processing a model step has not finished before the next step. I/O latency can contribute too. See CPU-overload troubleshooting [8].

A finer step size can improve result quality while reducing the available execution budget. Record the numerical comparison and timing measurements on the intended target as separate evidence. A fast desktop simulation cannot supply a measured target-hardware runtime.

What belongs in the validation record?

This record structure and validation workflow are original engineering recommendations. They connect solver selection with the decision the simulation is meant to support. The guide to validating engineering knowledge graphs also addresses traceable links between decisions and evidence.

Primary sources

  1. MathWorks: Choose a Solver
  2. MathWorks: Choose a Fixed-Step Solver
  3. MathWorks: Variable Step Solvers in Simulink
  4. MathWorks: Types of Sample Time
  5. MathWorks: Check and Improve Simulation Accuracy
  6. MathWorks: Fixed-Step Solvers in Simulink
  7. MathWorks: Zero-Crossing Detection
  8. MathWorks: Troubleshoot Overloaded CPU from Executing Real-Time Application

Documentation baseline: R2026b; sources checked on 27 November 2026. This article describes a validation plan and publishes no independently measured simulation or hardware results. Special cases such as local Simscape solvers require additional product-specific configuration.