function [t,y]=ode1(h,tspan,y0) %differential equation solver framework using Euler method tinitial=tspan(1); tfinal=tspan(2); tvec(1)=tinitial; yvec(1)=y0; for i=2:(tfinal/h+1) tvec(i)=tvec(i-1)+h; yvec(i)=yvec(i-1)+h*yvec(i-1); i=i+1; end t=tvec; y=yvec; end