function eul2

delta = .1;
t0 = 0;
tend = 1;
x0 = 1;
y0 = 1;

t = [t0:delta:tend];
y = zeros(2,size(t));

y(1,1) = x0;
y(2,1) = y0;
disp(sprintf('k:\tt_k\t\tx_k\t\ty_k'));
disp(sprintf('0:\t%f\t%f\t%f',t(1),y(1,1),y(2,1)));

for i = 2:length(t)
    t(i) = t(i-1)+delta;
    y(:,i) = y(:,i-1)+delta*feval(@fun, t(i-1),y(:,i-1));
    disp(sprintf('%d:\t%f\t%f\t%f',i-1,t(i),y(1,i),y(2,i)));
end

function f = fun(t,y)
f = zeros(2,1);
%f
f(1,1) = y(1)+y(2);
%g
f(2,1) = -y(2); 