
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

% Fixed Point Method a=input('[Note: Set f(x)=0 then x=g(x)], Enter g(x)\n', 's'); f=inline(a); x0=0; tol=input('Enter Acceptable Error in Percent\n'); xr=x0; iter=0; fprintf('Attempt Root Error\n'); for i=2: xrold=xr; xr=f(xrold); iter=iter+1; format longg if xr~= e=abs(xr-xrold)/xr*100; end fprintf('\t%d\t\t%.9f\t%.2f\n',i-1, xr, e) if e<tol; break,end end fprintf('Final Attempt Root Error\n'); fprintf('\t%d\t\t\t%.9f\t\t%.2f\n',i-1, xr, e)