%Euler method with initial conditions in 1st row
function [t,x]=ex_euler(fh,t0,x0,tmax,npts)
n=npts-1;
h=(tmax-t0)/n;
t(1)=t0;
x(1)=x0;
for k=1:n
    t(k+1)=t(k)+h;
    dx1=h*fh(t(k),x(k));
    dx2=h*fh(t(k+1),x(k)+dx1);
    x(k+1)=x(k)+(dx1+dx2)/2;
    
end;