clf

y0 = 1;         % initial value
h = [0.011 0.0099 0.0049]; % step sizes

% Solve system by forward Euler with step sizes as above
for i=1:3,
    t = [0 (100*h(i))];   % time period (take 100 steps with step size h(i))
    y = euler(h(i),y0,t,@testEq);   % approximate solution 
    
    mesh = 0:h(3):(100*h(3));       % plot approximate solution
    plot(mesh,y)
    hold on
    plot(mesh,exp(-200*mesh),'r')   % exact solution
    st = ['Step size = ',num2str(h(i))];
    title(st)
    legend('approximation','exact')
    
    pause
    clf
end

    
