function [ t,x ] = e614( t0,T,dt,f,x0 )
% MATLAB Function that uses Explicit Euler to solve the ODE x'=f(t,x)
% in the interval [t0,T]

% INPUT: 
% t0 and T extrema of the interval
% dt time-step
% f function
% x0 initial value x(0)

N=(T-t0)/dt; % number of steps
x=zeros(N+1,1); % initialization of the solution and times arrays
t=zeros(N+1,1);
x(1)=x0;
t(1)=t0;

for i=2:N+1
    x(i)=x(i-1)+dt*f(t(i-1),x(i-1)); % explicit euler
    t(i)=t(i-1)+dt;
end

end

