Rescursion Limit Reach?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Paulo Silva
il 26 Apr 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 Commenti
Paulo Silva
il 26 Apr 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.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!