i cant understand meaning of this comment . whenever i run program it show this msg. suggest any solution

Maximum recursion limit of 500
reached. Use set(0,'RecursionLimit',N)
to change the limit. Be aware that
exceeding your available stack space
can
crash MATLAB and/or your computer.
Error in ==> ode45

 Respuesta aceptada

James Tursa
James Tursa el 27 de En. de 2013
Editada: James Tursa el 27 de En. de 2013
You have a function that directly or indirectly calls itself. It did so 500 times without returning in your run. That usually means you have done this inadvertently in your code and you likely have a bug in your code (a forever recursion).

1 comentario

Right.
It is common for beginners to attempt to use a structure such as
function myfun
... set up parameters
ode45('myfun', ....)
This kind of structure does not work, as it has myfun invoke ode45 which invokes myfun which invokes ode45, and so on endlessly.
Instead the following kind of structure should be used:
function myfun
... set up parameters
ode45(@myotherfun, ...)
end
function myotherfun(t,x)
... do what needs to be called from ode45
end

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Etiquetas

Preguntada:

el 27 de En. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by