% loop.m
%
% Program to determine approximate solution to
% model ode for various stepsizes
%
% Model ode is
% y'=v
% v'=-v -sin(ty)
%

    [tex,yex]=ode45('examp',0,1,[1 2],1e-8);
    yexact=yex(length(yex),1);
    for i=1:8
      k=1/2^i;
      [t,y]=eulerint('examp',k,0,1,[1;2]); 
      sol=y(1,length(y));
      error=abs(sol-yexact);
      fprintf('Stepsize, Sol, Error: %e, %e, %e \n',k,sol,error); 
    end;
      
