function xc=fixpt(f,x0,k) %FUNCTION xc=fixpt(f,x0,k) % Computes approx solution to f(x)=x % Input: Inline function f, initial pt x0 % and max number of iterations, k % Output: The orbit of x0 is in xc (the % last element is our best approx) % EXAMPLE: Find the FP to f(x)=(1-x)^(1/3) % f=inline('(1-x).^(1/3)'); % x0=0.5; k=25; % xc=fixpt(f,x0,k); % x(1)=x0; for i=1:k x(i+1)=f(x(i)); end xc=x;