function [t,x]=eulr(fun,t0,x0,N,h)
% EULR(fun,t0,x0,N,h) is a function that uses Euler's method to numerically 
% solve an initial value problem for a first order ODE. Here, fun
% can be either a function of x and t, or an expression in x and
% t. (If fun is an expression, then the variables MUST be x and t.)
% t0 is the initial value for t, and x0 is the initial value for
% x. N is the number of steps to be used, and h is the step size. 
% 
% Professor F. J. Narcowich, 21 January 1999
% 
f=fcnchk(fun,'t','x');
t=t0+(0:N)*h;
x=[x0,zeros(1,N)];
for nn=1:N, 
  x(nn+1)=x(nn)+feval(f,t(nn),x(nn))*h;
end




