%metodo de euler simples (explicito)
function [t,x] = Euler(t0,tf,x0,dxdt,n)

if nargin < 5 n = 50; end

%condicoes iniciais
t(1) = t0;
x = x0;
xs = x0;
%passo de integracao
h = (tf-t0)/n;

%loop de integracao
for i = 1:n
    dx = feval(dxdt,t(i),xs);
    xs = xs+h*dx;
    t(i+1) = t(i)+h;
    x = vertcat(x,xs);
endfor

end