function ode_4
% solve  dx/dt = 3 exp(-t)
% solve  dx/dt - 3 exp(-t) = 0
% initial condition x(0) = 0
  sprintf('ode_4.m solve for x, dx/dt - 3 exp(-t) = 0')
  t = 0:0.001:5;  % time scalex 5001 points
  initial_x = 0;
  [t,x] = ode45(@rhs, t, initial_x);
  plot(t,x);
  xlabel('t');
  ylabel('x');
  n = size(t)
  m = n-1
  sprintf('t(1)=%f, x(1)=%f, exp(-t(1))=%f', t(1), x(1), exp(-t(1))) 
  sprintf('t(2)=%f, x(2)=%f, exp(-t(2))=%f', t(2), x(2), exp(-t(2))) 
% sprintf('t(n-1)=%f, x(n-1)=%f, exp(-t(n-1))=%f', t(m), x(m), exp(-t(m))) 
  sprintf('t(n)=%f, x(n)=%f, exp(-t(n))=%f', t(n), x(n), exp(-t(n))) 

  sprintf('ode_4.m finished')
  function dxdt=rhs(t,x) % move everything past =
    dxdt = 3*exp(-t);
  end % rhs
end % ode_4
