Derivative of state '1' in block 'X/Y/Integrator' at time 0.55 is not finite.
Afficher commentaires plus anciens
An error occurred while running the simulation and the simulation was terminated Caused by: Derivative of state '1' in block 'X/Y/Integrator' at time 0.55 is not finite. The simulation will be stopped. 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). How to fix this error?
4 commentaires
MASSAMBA
le 14 Avr 2023
personnellement j'ai le meme probléme et j'arrive pas à le resoudre , si quelqun à la solution je veux bien.
MASSAMBA
le 14 Avr 2023
Personally I have the same problem and I can't solve it, if someone has the solution I'm willing.
Sam Chak
le 14 Avr 2023
Hi @MASSAMBA
Please post your Simulink model (a snapshot) on a New Question. It allows to use to visually inspect if there is any block that cause the problem.
By the way, most of the time, the true singularity problem cannot be solved by merely reducing the fixed step size or by tightening the error tolerances. Take note!
Sourabh
le 22 Mai 2023
Modifié(e) : Walter Roberson
le 22 Mai 2023
mdl = 'rl_exam'
obsInfo = rlNumericSpec([2 1]);
obsInfo.Name = 'observations';
obsInfo.Description = 'integrated error and error';
actInfo = rlNumericSpec([1 1]);
actInfo.Name = 'PID output';
env = rlSimulinkEnv(mdl,[mdl '/RL Agent'],obsInfo,actInfo)
agentOpts = rlDDPGAgentOptions(...
'SampleTime',0.01,...
'TargetSmoothFactor',1e-3,...
'DiscountFactor',0.99,...
'ExperienceBufferLength',100000,...
'MiniBatchSize',64,...
'NumStepsToLookAhead',2);
agent = rlDDPGAgent(obsInfo,actInfo,agentOpts)
This is the code i am using and i am getting
- Algebraic state in algebraic loop containing 'rl_exam2/calculate reward/Sum1' computed at time 0.30000000000000004 is Inf or NaN. There may be a singularity in the solution. If the model is correct, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances) or tweak the initial guess of algebraic loop variable values.
as error . i dont know how to attach the simulink file. i am stuck from last 5 days on this, any help would be great.
Réponses (10)
Sorelys Sandoval
le 21 Août 2016
11 votes
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
20 commentaires
Maria Angela Agizza
le 21 Nov 2016
This answer helped me a lot, thanks
jinghua sun
le 26 Sep 2017
that does help!Thanks!
Maria Jaramillo
le 7 Nov 2017
Funciono!! Muchas gracias
Abinash Baruah
le 15 Nov 2017
but it didn't work for me.can i get any other solution
Mira Mamdouh
le 2 Déc 2017
it didn't work for me did you reach any other solution ? if so please share
Joel Fernandez
le 27 Mai 2020
It works, because it reduced properly the time-step. However, it can significantly retard the whole process.
Using ode15s takes much more time than ode1 (Euler) for example. You should verify your initial parameter values e.g : perform a load-flow (allowing asynchronous machine initialisation) in an electrical power system.
Charles Collins
le 16 Mar 2021
didnt work for me either
Frank Kulor
le 23 Mai 2021
okay
Jamil Hassan
le 19 Juin 2021
Thank you.It worked for me as well
KNourdine
le 9 Nov 2021
No it doesn't work
Karen Wilches
le 22 Sep 2022
No it doesn´t work x2
Walter Roberson
le 22 Sep 2022
Changing solvers will typically not succeed in cases where the model is not initialized properly, or in cases where the model is created incorrectly, or in cases where the dynamics is unstable.
For example if the model effectively has a division by (position minus 10) then it will have problems in any situation where the position reaches 10, and switching to a diffrent solver cannot "solve" that.
Erika Yulieta
le 11 Nov 2022
n error occurred while running the simulation and the simulation was terminated
Caused by:
- Derivative of state '1' in block 'tugasakhir/Battery/Model/Exp/Integrator2' at time 4.1000000000000707 is not finite. The simulation will be stopped. 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)
how to fix this error. i had tried to change the solver to ode15s(stiff/NDF) and didnt works. if you know another solution please reply my comment
Sam Chak
le 11 Nov 2022
This probably indicates there maybe division-by-zero
(the denominator approaches 0) or
-like components in the Simulink model. Please check. If true, then the singularity issue can be avoided merely by changing the ode15s solver.
If you still cannot identify the issue, you are advised to post a new question with the Simulink model attached.
Julio Cesar Guzmán Jasso
le 18 Nov 2022
CHIDO MI BRO ERES LA MERA CORNETA
VIGNESH BALAJI
le 11 Oct 2023
It did not work for me and it always stops at zero.
Sam Chak
le 12 Oct 2023
Hi, @VIGNESH BALAJI, have you identified the singularity occurence in your Simulink model? If not, try posting a New Question and attach the Simulink slx file, so that we can investigate.
VIGNESH BALAJI
le 12 Oct 2023
@Sam Chak thanks for your reply. I found the singularity occurrence in my model and rectified it, It was a calculation returning NaN (Improper calculation) that is propogating at the integrator of the system.
Sam Chak
le 12 Oct 2023
@VIGNESH BALAJI, Good to hear that you've fixed the issue!
Nicolas CRETIN
le 26 Avr 2024
Modifié(e) : Nicolas CRETIN
le 21 Mai 2024
I don't have exactly the same error, but the following has helped in my case: I reduced the relative tolerance in the solver parameters:

hope it can help someone!
Sebastian Castro
le 4 Nov 2015
10 votes
This usually has to do with really large or infinite signals feeding into an Integrator block. Numerical solvers (expectedly) have trouble integrating such large signals and therefore this leads to errors.
Typical causes can be divide by zero (1/0 = inf) or general unstable dynamics that quickly blow up over time. You should check that in your model. It can help to use Port Value Displays as you step through the model to figure out why this happens.
- Sebastian
Abhiram V. P. Premakumar
le 1 Avr 2021
Modifié(e) : Abhiram V. P. Premakumar
le 30 Juin 2023
2 votes

I solved this issue by eliminating the infinite signal, using a switch block, and setting a clock as it's threshold (or a step block with t=1e-3). Denominator of a DIVIDE block being 0 at the beginning of a simulation, was the issue in my case. Using a clock or a step signal starting at t=1e-3s, along with a switch block, can make the divide block in the output of the switch block use a finite value temporarily, until the actual signal becomes finite.
10 commentaires
chuyen hoangcao
le 10 Juin 2021
hello Abhiram, I dont know whether your solution affects so much to the simulation model or not? How did you switch block and setting clock
Abhiram V. P. Premakumar
le 10 Juin 2021
My understanding is that it is due to division by zero. You may get around that problem using any method which is plausible.
KNourdine
le 9 Nov 2021
hello Abhiram, could you be prcise more on how using switch block and
clock
Ndip Cyril
le 20 Mar 2022
Hello Abhiram. Could you please explain how exactly you did this?
Abhiram V. P. Premakumar
le 21 Mar 2022
Hi Ndip, The denominator of a divide block should never have 0 coming at the input. There are several ways to achieve that. One example is to use the ‘switch’ block for the denominator signal. Add ‘clock’ to the middle input, no input to the 3rd input, and the denominator signal to the 1st input of the switch block. Output of switch block goes to the denominator of ‘divide’ block.
Walter Roberson
le 20 Mai 2022
If you are not expecting negative values then instead of switch blocks use a max block with the second input being a constant block with value being the value that should be substituted if the denominator is too small.
SALAH alatai
le 29 Déc 2022
@Abhiram V. P. Premakumar what about the clock , what value should I put inside to adjust it ?
OLUWASEUN ADEKOYA
le 30 Juin 2023
@Abhiram V. P. Premakumar It would be great if you could be more elaborate on what specific values you put into what. For example, the clock, the only option I see here is decimation (which ofcourse only permits positive integer values). Is that the threshold value you are referring to?
Also, MATLAB's Simulink signals an error when a port is empty. Should one worry about that?
Finally. did you mean "integrator block" when you refer to "divide block"?
Thanks in anticipation.
Abhiram V. P. Premakumar
le 30 Juin 2023
Denominator of a DIVIDE block being 0 at the beginning of a simulation, was the issue in my case. A clock or a step signal starting at t=1e-3s, can make the divide block use a finite value temporarily until the actual signal becomes finite.
Sushovan
le 2 Déc 2024
Thank you Sir
Guy Rouleau
le 25 Juil 2024
1 vote
I describe the most common reasons for this error in this blog post:
The most common causes are:
- A modeling error making the equations diverging
- Too large step size
- Division by zero
4 commentaires
RAGHUVEER RAJESH
le 3 Sep 2024
How to find the division by zero in a large model?
Guy Rouleau
le 3 Sep 2024
Set this diagnostics to Error, it will point to the block where the division by zero happens:

文德
le 13 Déc 2024

Hello! I have built a motor simulation circuit, and I encounter an error when running it, as shown in the image. I have been unable to find a solution. Could you please help me identify the problem and suggest how to resolve it? Thank you!
Walter Roberson
le 13 Déc 2024
@文德
Compiling the model reports several input and output ports of various Mux are not connected.
It also reports,
Warning: Derivative block 'untitled/转矩绕组电压模块2/Derivative1' might produce unexpected or incorrect output values because the input
signal is not differentiable. Consider changing the model so the input signal has continuous sample time or implementing the
derivative using a Transfer Fcn block instead of the Derivative block.
and the same for Derivative2
Meanwhile, the input signal i4d is going to at least 1e+184 at time 0.0009
ahmet akgün
le 2 Mai 2021
0 votes
Adaptive Sliding-Mode Control for Boost DC–DC Converters simulation simulation fails;''Derivative of state '1' in block 'power_BoostConverter_Adaptive_SMC_math/TSMC Controller/Integrator' at time 0.0 is not finite. The simulation will be stopped. 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) ''
How to fix this error?
6 commentaires
Himani Modi
le 9 Sep 2021
I am facing the same issue.
Mohammed-Amine MOSSADAK
le 10 Nov 2021
Me too.
Stéphanie Monteiro
le 28 Fév 2022
Hello,
Can you solve this error? Can you help me, please?
Thank you!!
Walter Roberson
le 20 Mai 2022
you have a problem with the initial conditions
Ambe Harrison
le 23 Août 2022
Hello,ahmet akgün. I am presently working on a Back steeping controller. Face thesame problem with the integrator. Please have you solved it.
If possible we may exchange more via email, ambeharrison2000@gmail.com
Zakarya Motea
le 10 Déc 2023
If your system has multiple chanels Try to tune them one by one. When tuning one chanel let the input for other chanels as zero.
Pavke
le 7 Mar 2023
0 votes
Hello guys
I am doing a project in simulink and I have a problem. It is about braking an asynchronous motor with direct current, which I made (it works correctly), and it is necessary to connect that system to the distribution network (I use IEEE Bus 13). I connected the braking system of the asynchronous motor to the distribution network, and the system starts to work, it goes down from 1800 reversions and comes to 1480, and by the end of the simulation it stands at 1480, the engine will not brake and the simulation does not finish to the end and the following error occurs :
An error occurred while running the simulation and the simulation was terminated Caused by: Derivative of state '1' in block 'distributivnamrezamodel/Transfer Fcn' at time 0.991475799999991 is not finite. The simulation will be stopped. 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).
How to fix this problems?
Thank you
3 commentaires
GEORGIOS
le 16 Mar 2023
hey , did you find a solution on this ?
Daniel Joseph
le 28 Mar 2023
Try to figure out why is your signal really large/infinite. Is divide by zero correct in this case? maybe you can substitute a very small value like 1e-6 instead of zero, using the switch example shown above by @Abhiram V. P. Premakumar, such that the solver does not get bogged down at very small /large values.
Sushovan
le 2 Déc 2024
Thank you Sir
Anton
le 23 Avr 2023
Modifié(e) : Walter Roberson
le 22 Mai 2023
Hello, I have the same error. Please help me figure out what's wrong.
K1 = 2000;
K2 = 1;
Kk1 = 0.0012;
T1 = 0.2;
T2 = 0.005;
Tk1 = 0.0001;
T3 = 0.1;
Kt = 0.5;
tp = 0.280;

4 commentaires
Saleh Altbawi
le 23 Avr 2023
Hi, try to change the different options of the solver selection.
Hi @Saleh Altbawi, it is definitely not the solver. When a system is unstable, it doesn't matter what solver is chose. Here is a simple example of an unstable transfer function, with a positive pole.

Saleh Altbawi
le 24 Avr 2023
Hi. The system is not stable at specific time does not mean division on zero. If that true it should not work from the beginning. That mean solver at specific time could not convergence the transfer function. So try to use different kinds of solver. If does not work then try to update your system's parameters.
Yingxin Zhang
le 22 Mai 2023
0 votes


hey i have the same problem, can you help me?
1 commentaire
OLUWASEUN ADEKOYA
le 30 Juin 2023
Any luck on this yet?
I'm currently experiencing some similar issues with this as well. Thanks.
Hugo
le 2 Oct 2024
0 votes
When I get this error, I can fix this by using the folling method :
- run your model using the step forward function (run step by step)
- Starting from the integrator block that makes the model stop, clik on signals to display values
- Track the signal until you find where the value diverges
- make the necessary corrections.
It works for me. I hope it will help you.
Catégories
En savoir plus sur Assumptions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
