%-------------------------------------------------------%
% Euler_method: for second order differential equations %
%-------------------------------------------------------%


function [x_E, v_E, t] = second_ord_Euler(t1, tN, x0, v0, N, dv)

t=linspace(t1,tN,N);
dt=t(2)-t(1);

x_E(1)=x0; v_E(1)=v0;
for i=1:N-1
   x_E(i+1)=x_E(i) + dt*v_E(i);
   v_E(i+1)=v_E(i) + dt*dv(x_E(i),t(i));
end

end