Code covered by the BSD License  

Highlights from
Numerical Methods Using MATLAB, 3e

image thumbnail

Numerical Methods Using MATLAB, 3e

by

 

20 Aug 2002 (Updated )

Companion Software

fixedpoint(g,p0,tol,max1)
function [k,p,err,P] = fixedpoint(g,p0,tol,max1)

P(1)= p0;

for k=2:max1
	P(k)=feval(g,P(k-1));
	err=abs(P(k)-P(k-1));
	relerr=err/(abs(P(k))+eps);
	p=P(k);
	if (err<tol) | (relerr<tol),break;end
end

P=P';

Contact us