f=@(x,t)x^2*cos(t);
h=1/16;
x(1)=1/2;
t(1)=0;
T=8;
for n=1:T/h
    x(n+1)=x(n)+h*f(x(n),t(n));
    t(n+1)=t(1)+h*n;
end;
plot(t,x);