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