%Improved Euler Method

function [y] = Euler(x0,h,tmax)
   x(1)=x0;
   time(1)=0;
   n = tmax/h+1;
  for i=2:n
	  xtilde=x(i-1)+h*f(x(i-1),time(i-1));
	  x(i) = x(i-1)+0.5*h*(f(x(i-1),time(i-1))+f(xtilde,time(i-1)));
	  time(i)= (i-1)*h;
  end
  plot(time,x);
  y = x(n);  