while e > tol && i==x_max; e=((x(i+1)-x(i))/x(i+1))*100;endswitch (e) case {e< tol} fprintf('Success!The result is %.4f\n',e) case {i==x_max} fprintf('Maximum number of iteration used.') case {-e} fprintf('The number was negative.')end
MATLAB: I am trying to find the absolute relative error of an iteration and i cant get it to work.here is the code.the equation seems to give me wrong results and then i cant get the switch statement to work.what am i doing wrong
homework
Best Answer