% Root finding using fixed-point iteration. clear; fprintf(' Fixed-Point Iteration Method.\n'); % If conditions for the existence of a fixed point and convergence of % a fixed-point iteration are satisfied we can proceed according to %the following procedure. % Input a tolerance for the error "TOL" and a maximum number of % iterations "itmax". % INITIAL DATA ************** p0=1; TOL=.0001; itmax=100; A=-1; B=2; % GRAPH OF THE FUNCTION************************************ % step=(B-A)/100; % x1=A:step:B; % y1=fp(x1); % plot(x1,y1) % xlabel('x'); ylabel('f(x)'); % grid on disp(' it Cterr p fp(p)'); for it=1:itmax p=fp(p0); Coterr=abs(p-p0); disp( [it,Coterr, p, fp(p)]); if Coterr