function am107
%
% The Nicholson-Bailey Model
%
% inputs:  N0 - the initial host population
%          P0 - the initial parasite population
%          T  - the total number of steps
%
% output:  a graph of N0 vs P0, N0 and P0 vs time 
%          and the final values N(T+1) and P(T+1)
%
% %Get the necessary variables%
%
N0 = input('Enter the initial host population, N0 = ');
P0 = input('Enter the initial parasite population, P0 = ');
T = input('Enter the total number of steps, T = ');
lambda=2;
a=0.069;
c=1;
%
% %Note:For these parameters, there is an equilibrium near N=20, P=10%
%
% %Initialize the variables%
%
N = zeros(1,T+1);
P = zeros(1,T+1);
Time = 1:T+1;
N(1) = N0;
P(1) = P0;
%
% %Iterate Nicholson-Bailey%
%
for i=2:T+1
  N(i) = lambda*N(i-1)*exp(-a*P(i-1));
  P(i) = c*N(i-1)*(1-exp(-a*P(i-1)));
end
%
% %Produce the promised output%
%
subplot(1,2,1)
plot(N,P,'*')
subplot(1,2,2)
plot(Time,N,'-*',Time,P,':o')

display(N(T+1))
display(P(T+1))
