Why am I receiving error messages about singularities in my Simulink model?

504 views (last 30 days)
I am receiving the following error messages about singularities in my Simulink model:
Derivative of block at time is Inf of NaN. Stopping Simulation. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances.)
I have tried reducing the step size and adjusting tolerances, but I still receive this error message. I have also tried changing solvers, some solvers will just get to one point of the simulation, and hang.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Apr 2011
This message may be caused by a singularity in your system. One situation where this may occur is if the values of your states differ by a large magnitude. If this is the case, the Simulink solver will have a hard time resolving your step size within the error tolerance as it attempts to "bounce" back and forth between the states.
To check if this is the case:
1. Return the states of your system as follows-
a) In the model editor go to Simulation-> Configuration Parameters
b) Select Data Import/Export, in the 'Save to Workspace' field, check 'States' to log the states as output
2. Run the simulation.
3. Plot:
plot(tout,xout)
You can see if one of the states is changing over a wide range compared to the others.
There are a couple of things you can do to try to correct this situation. If possible, you may want to rescale the model so that the states are within a couple of orders of magnitude of one another.
Also, you can set specific error tolerances for the integrator blocks in your system. For more information, please refer to 'Specifying the Absolute Tolerance for the Block's Outputs' section in the Integrator block documentation by entering
doc integrator
at the MATLAB command prompt.
  4 Comments
Walter Roberson
Walter Roberson on 1 Dec 2015
nor intanliana mohd sadik, you already posted that.
"I need to solve this as soon as possible" means that it is so important that all 6 billion or so people in the world who are not actively saving someone's life at the moment, must stop what they are doing and help you solve it, no matter what the inconvenience to them, and doing nothing else that does not involve keeping someone alive, because that is what would get you the solution "as soon as possible".
If you need that kind of assistance from everyone in the world, because a solution must be arrived at "as soon as possible" then you are going to need massive coordination from international emergency services people. For example they are going to need to go around door-to-door and wake people up and get them to work on the problem. Therefore if you need an answer "as soon as possible" you should not be starting with us, you should be starting with your police or your diplomats or who-ever else can undertake this massive coordination of people world-wide to solve your problem as soon as possible.

Sign in to comment.

More Answers (1)

Sorelys Sandoval
Sorelys Sandoval on 21 Aug 2016
Hi, I had the same problem and the next thing worked for me:
Go to model configuration parameters/Solver/Solver Options: Type: Variable-step Solver: ode15s (stiff/NDF)
and that's all. Hope it works for you :D

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!