%closeplot;

x1 = 0;
x2 = -2/3;

dt = 0.125/2;
i=1;
for t=0:dt:10
  soln(i,1)=t;
soln(i,2) = x1;
soln(i,3) = x2;
soln(i,4) = -1/3*sin(2*t);
  f1 = x2
f2 = sin(2*t)-x1
    x1old = x1;
x2old = x2;
x1 = x1old + f1*dt + 1/2*f2*dt^2;
x2 = x2old + f2*dt + 1/2*(-x2old + 2*cos(2*t))*dt^2;
%x1 = x1 + f1*dt;
%x2 = x2 + f2*dt;
i++;
endfor

plot(soln(:,1),soln(:,4)-soln(:,2))
  hold on;
