Error about “Maximum recursion limit of 500 reached”

1 visualización (últimos 30 días)
Sepanta Gharib
Sepanta Gharib el 16 de Ag. de 2018
Comentada: Sepanta Gharib el 16 de Ag. de 2018
In Matlab: Maximum recursion limit of 500 reached. It seems that one of functions is being called a lot.
Increasing the Recursion Limit using set(0,'RecursionLimit',N) does not help because after I do that and run my code, Matlab crashes (and it crashes for any value N larger than 500)
I've attached my code in [ my google drive account ]. The main file is EtOH_1Butanol.m. The rest of the files are its functions.
  1 comentario
Stephen23
Stephen23 el 16 de Ag. de 2018
@Sepanta Gharib: please upload the code here by clicking the paperclip button.

Iniciar sesión para comentar.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 16 de Ag. de 2018
The problem is happening in Bubble_point_T() function. You are recursively calling it, and the termination condition is
if abs(sum(y)-1)<0.0001
But if you use MATLAB debugger to find the value of y inside the recursion, you will find that it is very large i.e. 10^180 and decreasing very slowly. You need to check your model or the function which is returning the incorrect values. I also noted that initially y is a 1D vector but the value of y returned by sub_loop() is a 2x2 matrix, maybe this gives you some hint of the problem.
To use the debugger you might need to replace parfor loop with the for loop.
  1 comentario
Sepanta Gharib
Sepanta Gharib el 16 de Ag. de 2018
Yes, you are completely right. Because I tested the same code on another model, and it was quite responsive and the results were satisfactory.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by