clear; clf; t = input('please enter starting t: '); y = input('please enter starting y: '); tstop = input('please enter ending t: '); tsteps = input('please enter n umber of time steps: '); %t = 0; %y = 1; %tstop = 2; %tsteps = 100; h = (tstop-t) / tsteps; for i = 1 : tsteps t(i+1) = t(i) + h; y(i+1) = y(i) + h*func(t(i),y(i)); end plot(t,y, 'ro'); axis([min(t)-1 max(t)+1 min(y)-1 20]); xlabel('t'); ylabel('y'); hold on; tt = t(1) : 0.01 : t(length(t)); yy = exct(tt); plot(tt,yy);