%
% rick2cyl.m - This MATLAB file illustrates the 2 point cycle
% possibilities of the discrete Ricker model
%  x(i+1)=a*x(i)*exp(-b*x(i))
% by graphing the composition of the map with
% itself, and drawing the 45 degree line 
% The user is prompted to read in the values
% of a and b to use and the graph is plotted from x =0 to 5/b
!c:
s=1;
n=100;
while s>0;
a=input('input parameter a:    ')
b=input('input parameter b:    ')
del=5./(b*n);
xstart=0;
y=zeros(n+1,1);
lin=zeros(n+1,1);
x=zeros(n+1,1);
for i=1:n+1
x(i)=xstart+(i-1)*del;
lin(i)=x(i);
y(i)=a*(a*x(i)*exp(-b*x(i)))*exp(-b*(a*x(i)*exp(-b*x(i))));
end
plot(x,lin,x,y)
title('graph and y=x'),pause
s=input('Do you want to stop - if so enter 0')
end

