
figure(1);
[x,y]=meshgrid(-5:0.2:5,-5:0.2:5);
xp=f(x,y);yp=g(x,y);
L=sqrt(xp.^2+yp.^2);
quiver(x,y,xp./L,yp./L);
hold on;
axis([-2 2 -2 2]);

[t,Y]=ode45(@(t,Y)[f(Y(1),Y(2)); g(Y(1),Y(2))],[0 12],[1,-0.1]);
plot(Y(:,1),Y(:,2),'LineWidth',1);
hold off;

figure(2);
plot(t, Y);
hold off;

function z=f(x,y)
z=y;
end

function z=g(x,y)
z=-x+x.^2;
end



