clear
figure(1)
clf
dt = 0.001

%G = goats;
%T = tigers;

a(1) = 0.001;
b = 0.06;
k = 0.1;
l = 0.3
time = 2;
n_stop = time/dt +1;

G(1) = 70;
T(1) = 50;
clf
a_step=0.001;

a_stop = 0.1/a_step+1;

for i = 2: a_stop

a(i) = a(i-1)+a_step;

for n = 2: n_stop

G(n) = G(n-1) + dt*(b*G(n-1)-a(i)*T(n-1)*G(n-1));
T(n) = T(n-1) + dt*(a(i)*k*G(n-1)*T(n-1)-l*T(n-1));

end
figure(1)
clf
time_vector = (0:dt:time);
plot(time_vector, G,'g');
hold on
plot(time_vector, T, 'r');
axis([0 2 0 70]);
xlabel('Time (years)');
ylabel('Population');
legend('Goats', 'Tigers');

%set(gca, 'Box', 'off');
%set(figure(1), 'color', 'white');

M(i-1) = getframe(1);
end %end of a-loop

movie(M);
movie2avi(M,'temp.avi');
