About Solvers

You simulate a dynamic system by computing its states at successive time steps over a specified time span. This computation uses information provided by a model of the system. The time steps are time intervals when the computation happens. The size of this time interval is called the step size. The process of computing the states of a model in this manner is known as solving the model. No single method of solving a model applies to all systems. Simulink® provides a set of programs called solvers. Each solver embodies a particular approach to solving a model.

A solver applies a numerical method to solve the set of ordinary differential equations that represent the model. Through this computation, it determines the time of the next simulation step. In the process of solving this initial value problem, the solver also satisfies the accuracy requirements that you specify.

Solvers are broadly classified using these criteria:

  • The type of step size used in the computation

    • Fixed-step solvers solve the model at step sizes from the beginning to the end of the simulation. You can specify the step size or let the solver choose the step size. Generally, decreasing the step size increases the accuracy of the results and increases the time required to simulate the system.

    • Variable-step solvers vary the step size during the simulation. They reduce the step size to increase accuracy when the states of a model change rapidly and during zero-crossing events. They increase the step size to avoid taking unnecessary steps when the states of a model change slowly. Computing the step size adds to the computational overhead at each step. However, it can reduce the total number of steps, and hence the simulation time required to maintain a specified level of accuracy for models with piecewise continuous or rapidly changing states.

  • The nature of states in the model

    • Continuous solvers use numerical integration to compute continuous states of a model at the current time step based on the states at previous time steps and the state derivatives. Continuous solvers rely on individual blocks to compute the values of the discrete states of the model at each time step.

    • Discrete solvers are primarily for solving purely discrete models. They compute only the next simulation time step for a model. When they perform this computation, they rely on each block in the model to update its individual discrete state. They do not compute continuous states.

When you choose a solver for simulating a model, consider:

  • The dynamics of the system

  • The stability of the solution

  • The speed of computation

  • The robustness of the solver

A solver might not completely satisfy all of your requirements, so use an iterative approach when choosing one. Compare simulation results from several solvers and select one that offers the best performance with minimal tradeoffs.

There are two ways to select a solver for your model:

  • Use auto solver. New models have their solver selection set to auto solver by default. Auto solver recommends a fixed-step or variable-step solver for your model as well as maximum step size.

  • If you are not satisfied with simulation results using auto solver, select a solver in the Solver pane in the model configuration parameters.

Related Examples

More About

Was this topic helpful?