% This program uses Euler's method to solve the D.E.'s
%    dy1/dt =  -y2
%    dy2/dt =  y1 - y2/t
% where y1(0)=1 and y2(0)=0
clear;

h = 0.02;
tstart = 0;
tend = 10;

Y1(1) = 1;
Y2(1) = 0;

k = 1;

for t = tstart:h:tend-h
   Y1prime = -Y2(k);
   Y2prime = Y1(k) - Y2(k);

   Y1(k+1) = Y1(k) + h*Y1prime;
   Y2(k+1) = Y2(k) + h*Y2prime;

   k = k+1;
end

t = tstart:h:tend;

plot(t,Y1,t,Y2,'--');
