title: debug code, not sure why im not getting the right value for x1
body: <pre><code>function [x1] = tutorial1(x0,nMax,tol)
  % Calculate the root of the function f(x) = x^3 - 3^x + 1
  % using the Newton Method of root-finding.
  % Inputs: 
  %        - x0     initial guess
  %        - nMax   number of iterations
  %        - tol    solution accuracy tolerance
  % Output:
  %        - x1     converged root of the equation
  % Initialisation of the values x0, nMax, to
  
  x0 = 1.5;
  nMax = 15;
  tol = 1e-4;
  
   % for loop acting continously for 15 iterations 
  for i = 1:nMax
     fx0= (x0).^3-3.^(x0)+1;
     differentialx0=3.*(x0.^2) - 3.^x0.*log(3);
     %function f(x0)respectively
     x1 = x0 -fx0./differentialx0;
  
     if abs(x1-x0)&lt;tol
     break
     end 
     x0 = x1; 
  
     fprintf('Iteration = %d, x0 = %.4f, x1 = %.4f, fx1 = %.4f\n',i,x0,x1);
      end 
  
   % Sample output code for monitoring (this should be included in your loop structure.
  
  
    return
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/NRQ5h.png" alt="enter image description here"></p>