Rescursion Limit Reach?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
When I try to run so I call values spring(200,10000,15000,0.1) I keep getting a Rescursion Error message. When I set the recursion level higher MatLab crashes. Any ideas how I can fix this. Code below: function x=spring(W,k1,k2,d) if ((W/k1)<d) x= W/k1; else x=(W + 2*d*k2)/(k1 + 2*k2); end
clf %clears the current figure window
hold on %creates new axes
st=5; %step by 5
for W=0+st:st:3000-st;% W is between 0 and 3000 and creates a loop
x= spring(W,k1,k2,d);
plot(W,x)
end
0 comentarios
Respuestas (1)
Paulo Silva
el 26 de Abr. de 2011
You have the spring function inside one m file called spring.m and the script that calls the spring function inside another file called something else? you run the script and you get the error about the recursion?! you are calling the spring function inside itself for sure, don't do that.
2 comentarios
Paulo Silva
el 26 de Abr. de 2011
That won't work, the function you made is called from the outside so you must have another script or function that calls the spring function.
I'm going to post a better code in your other Question, that code you are using was just to show a simple way to do it, it's very inefficient.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!