want to follow my iteration - how?
Show older comments
Hi, I want to follow how my while-loop iteration is proceeding at each step. How can I do this?****I want to understand and correct why my iteration is never ending:
v_m=10;
R_try=0;
v_m_try=0;
while abs(v_m_try-v_m)>0.01
if (v_m_try<v_m)
R_try=R_try+0.05;
v_0_try=sqrt(9.81*R_try*0.02);
v_m_try=0.4*log(12.27*v_0_try^2);
else
R_try=R_try-0.05;
v_0_try=sqrt(9.81*R_try*0.02);
v_m_try=0.4*log(12.27*v_0_try^2);
end
end
2 Comments
Jan
on 7 Oct 2011
Please use proper code formatting. Follow the "Markup help" link on this page.
Florin Neacsu
on 7 Oct 2011
Maybe use debugger?
Accepted Answer
More Answers (1)
Bjorn Gustavsson
on 7 Oct 2011
If you want to see what's going on you can use:
disp([v_m,v_m_try,v_0_try,R_try])
If that is not detailed enough check the trusty pair: fprintf and sprintf.
HTH,
Categories
Find more on Quadratic Programming and Cone Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!