MATLAB: Script isn’t running

Hi guys, can someone tell me how can i fix this script. Also, how can i know the it number?
for (b-a>tol)
if g_x1<g_x2
a=a
b=x2
x2=x1
elseif g_x1>g_x2
a=x1
b=b
x1=x2
end
end
for (b-a)<tol
break

Best Answer

for is used only for iterating a fixed number of times. To loop as long as a condition is true, use while
Related Question