clear all
clc
disp('Starting...............')

x0 = 0;
y0 = 0;
h = 0.05;
T = 0.1;
disp(' ')
disp(['Stepsize h =' num2str(h)])
disp(['End time T =' num2str(T)])
disp(' ')
k = 1;


while x0<T
    disp('----------------------------')
    disp(['Step: ' num2str(k) ',  From  ' num2str(x0) ' to ' num2str(x0+h)])
    disp(['          x0 = ' num2str(x0) '  and  y0 = ' num2str(y0)])
    x1 = x0 + h;
    disp(['x1 = ' num2str(x1)])
    
    k1 = x0 - y0;
    disp(['k1 = ' num2str(k1)])
    
    k2 = (x0 + h) - (y0 + h*k1);
    disp(['k2 = ' num2str(k2)])
    
    k3 = (x0 + 0.5*h) - (y0 + 0.5*h*(k1+k2)*0.5);
    disp(['k3 = ' num2str(k3)])
    
    y1 = y0 + (k1 + k2 + 4*k3)/6*h;
    disp(['y1 = '  num2str(y1)])
  
    disp(['y(' num2str(x1) ') = y1 = '  num2str(y1)])
    x0 = x1;
    y0 = y1;
    k = k + 1;
end
disp('--------------------------------')
disp(['Solution at x =' num2str(x0) '  is  y(' num2str(x0) ') = '  num2str(y0)])