function ode1(F, tspan, y0, h) % ODE1 : demo version of simple Euler method % ode1(F, tspan, y0, h) uses step size h and plots 1D results t0 = tspan(1); tfinal = tspan(2); t = t0; y = y0; plot(t,y,'r.'); hold on while t <= tfinal y = y + h*feval(F,t,y); t = t + h; plot(t,y,'r.') end; hold off;