global alpha beta delta gamma
% Define initial conditions.
alpha=1.2;
beta=0.8;
delta=0.7;
gamma=0.4;
t0 = 0;
tfinal = 30;
y0 = [0.3 0.7]';
% Simulate the differential equation.
tfinal = tfinal*(1+eps);
[t,y] = ode23('lotka',[t0 tfinal],y0);
% plot the result
subplot(1,2,1)
plot(t,y(:,1),'b')
hold on
plot(t,y(:,2),'r')
xlabel('Time')
ylabel ('Population size')
legend('Prey','Predator')
hold off

subplot(1,2,2)
plot(y(:,1),y(:,2))
xlabel('Prey')
ylabel('Predator')
