function raeuberbeute2

h = 0.05;
tfin = 10;
T = 0:h:tfin;

a = 3;
b = 1.5;
c = 0.8;
d = 1.5;

q0 = [2 1];

[T,Q] = ode45(@(t,q) rhs(t,q,a,b,c,d), T, q0);

[u,v] = meshgrid(0:0.2:4.5, 0:0.2:4);
for i=1:size(u,1)
    for j=1:size(u,2)
        tmp = rhs(0,[u(i,j) v(i,j)],a,b,c,d);
   % Skalierung der Pfeile, damit diese nicht zu lange sind
        tmp = tmp/norm(tmp,2)/7.5;
        du(i,j) = tmp(1);
        dv(i,j) = tmp(2);
    end
end
quiver(u,v,du,dv,0)
hold on
plot(Q(:,1),Q(:,2))
hold off
xlabel('u(t)')
ylabel('v(t)')
title('Raeuber-Beute Phasenplot')
set(gcf,'paperpositionmode','auto')
set(gca,'xlim',[0 4.5],'ylim',[0 4],'fontsize',15)
print('-depsc','-loose','rb2');

function dq = rhs(t,q,a,b,c,d)
dq = q;
dq(1) = q(1)*(a-b*q(2));
dq(2) = q(2)*(c*q(1)-d);
