title: Matlab backward Euler using fzero
body: <p>I am trying to integrate  dy3dt = @(t,y) -41*(y - t) + 1; over [0, 1] with h = 0.05 using backward Euler. The initial condition, y(0) is 1. </p>
  
  <pre><code>yvals3 = [1]; %inital condition
  dy3dt = @(t,y) -41*(y - t) + 1;
  for t = 0:0.05:0.95; 
  
      index = round(t*20 + 1); %convert t into index of the last step
      oldy = yvals3(index);
      newy1 = oldy + h.*dy3dt(t, oldy);
      newy2 = oldy + h.*dy3dt(t+ 0.05, newy1); 
      yvals3 = [yvals3; newy2];
  end
  tvals3 = 0:0.05:1;
  </code></pre>
  
  <p>When I graph tvals3 and yvals3, I am getting an unusual exponential graph, so my approach is probably incorrect. Any insight on how to implement this using fzero?</p>