Error occurred while running the simulation
33 views (last 30 days)
Show older comments
Hi,
I keep getting this error:
An error occurred while running the simulation and the simulation was terminated
Caused by:
Solver encountered an error while simulating model at time 6.6282282635683543e-17 and cannot continue. Please check the model for errors.
Nonlinear iteration is not converging with step size reduced to hmin (2.35482E-31) at time 6.62823E-17. Try reducing the minimum step size and/or relax the relative error tolerance.
I tried changing the solver from 'auto' to 'ode45' as someone suggested in other answers but the simulation now takes "infinite" time.
How could I try to figure out this issue?
0 Comments
Answers (1)
Sam Chak
on 30 Dec 2022
Hi Marco,
In most cases, the problem is likely caused by the singularity event, something like approaching the division-by-zero, or tan(90°). Also check if the system is "stiff" at the beginning of the simulation.
2 Comments
Sam Chak
on 30 Dec 2022
If your Simulink model consists of only fundamental blocks (no mask), then it should be rather easy to detect if there are any division block and trigonometric function block. Sometimes, then problem can be due to the system response is rapidly diverging to
. Take a look at this example in MATLAB (not Simulink).

fun = @(t, x) (1e4)*x;
tspan = linspace(0, 10, 1001);
x0 = 1;
[t, x] = ode45(fun, tspan, x0)
Also check if your system has discontinuities. Best is to post a clear screenshot of the Simulink model. Let the experienced users of Simulink help you to identify the root cause.
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!