%
%bevholt.m - this MATLAB file solves the 
%discrete first order non-linear hyperbolic difference
% equation (Beverton-Holt) often used as a 
%discrete analog of the continuous logistic
% growth model x(i+1)=R0*x(i)/(1+((R0-1.)/K)*x(i))
%and the user is prompted to read in the value
% of K and R0 to use as well as the initial value
% x0 and the time interval over which to run the 
% simulation.
!c:
s=1;
while s>0;
K=input('input parameter K:    ')
R0=input('input parameter R0:    ')
x0=input('input initial population x0:     ')
n=input('end of time interval b:     ')
x=zeros(n+1,1);
t=zeros(n+1,1);
x(1)=x0;
for i=1:n
t(i)=i-1;
x(i+1)=R0*x(i)/(1+((R0-1.)/K)*x(i));
end
t(n+1)=n;
plot(t,x,t,x,'o'),pause
s=input('Do you want to stop - if so enter 0')
end

