Running a simulation

To run a simulation of your Simulink model, you can select the button "Start Simulation" on the toolbar of the model. Take care, that the correct initial conditions are used for the integrator blocks. The simulation will finish when the maximum simulation time is reached. If this takes to long, you can terminate your simulation in the meantime by pressing the "Stop Simulation" button on the toolbar.

When the simulation is stopped, you can double-click on a scope to see the signal over time. Signals send to "To Workspace" or "To file" blocks are created in your workspace, or in the file in the current directory, respectively.

**Simulation parameters**

To edit the parameters used by Simulink to simulate the behavior of the system, click on Simulation

**Simulation time**

In this window, you will be able to set a start and stop time for your simulation. Note, that these times represent the simulated time, which usually differs from the computation time.

**Type of solver**
Many solver options can be changed. The most important one is the solver type. The solver type determines the time steps Simulink is taking. Though very small time steps are usually more accurate, they require longer computation time.

One can choose Variable-Step or Fixed-Step solvers. In a fixed step solver, the solver takes fixed time steps and computes at each time step, how the states should be updated. The most important option for this solver is the fixed-step size.

More complex solvers are variable-step solvers. They try to take their step size as large as possible, but will reduce the step size when the computation becomes less accurate. Usually, variable-step solvers are faster. By default, one should select the ode45 solver. However, for certain problems, ode45 will need very long computation times. In that case, one can choose a different solver, such as ode15s.

Important parameters that should be chosen for a variable step solver are the Relative Tolerance and the Absolute Tolerance. The relative tolerance measures the error relative to the size of each state. The relative tolerance represents a percentage of the state's value. The default, 1e-3, means that the computed state will be accurate to within 0.1%. The Absolute Tolerance is a threshold error value. This tolerance represents the acceptable error as the value of the measured state approaches zero. A variable step solver chooses its time steps such, that both absolute and relative tolerance are satisfied.

Esteur 2010-03-22