function x=fixpoint(g,x0,tol)
% fixpoint - fixed point iteration for the scalar equation x=g(x) 
% 
%   Syntax: 
%           x = fixpoint(g,x0,tol)
%   Arguments: 
%           g - string containing the name of a function file  
%           x0 - a real number, the initial approximation
%           tol - a tolerance 
%   Returns: 
%           x - an approximate solution 
%   Description:
%          The program fixpoint uses the fixed point iteration to 
%          compute an approximate solution of the scalar equation 
%          x=g(x).  The file g.m must contain the function y=g(x).  
%          The function g:I->I must be a contraction on some closed 
%          interval I.  Then g has a unique fixed point x_exact in I. 
%          If the initial approximation x0 belongs to I, then the 
%          program computes an approximate solution x with the error
%          |x-x_exact| < tol.  
%   Examples: 
%          x = fixpoint('cos', 1, 1e-7) computes x=0.73908513
%
%----------------------------------------------------------------------

Write your program here!

Possible structure:


while abs(dx) > tol

  dx =           % dx is the change in x, going from
                 % the j'th iterate to the j+1'st in
                 % x_{j+1} = g(x_j)          
  x = x + dx;    % updating x

end












