% % nicholson.m - this MATLAB file simulates the % 2-species Nicholson Bailey difference equation: % x(n+1) = lam*x(n)*exp(-a*y(n)) % y(n+1) = c*x(n)*(1-exp(-a*y(n))) % The user is prompted to read in the value % of x0 and y0, the paramters lam, a, and c % and the time interval over which to run the % simulation. !c: s=1; while s>0; lam=input('input lamda=host repro rate: ') a=input('input a=search efficiency of parasitoid: ') c=input('input c=parasitoid egg production per host: ') xbar=(lam*log(lam))/(a*c*(lam-1)); xbar ybar=(log(lam))/a; ybar x0=input('input initial population x0 of host: ') y0=input('input initial population y0 of parasitoid: ') n=input('input time period of run: ') x=zeros(n+1,1); y=zeros(n+1,1); t=zeros(n+1,1); x(1)=x0; y(1)=y0; for i=1:n t(i)=i-1; x(i+1)=lam*x(i)*exp(-a*y(i)); y(i+1)=c*x(i)*(1-exp(-a*y(i))); end t(n+1)=n; plot(t,x,t,x,'o') title('host values'),pause plot(t,y,t,y,'o') title('parasitoid values'),pause plot(x,y,'o') title('host vs parasitoid'),pause s=input('Do you want to stop - if so enter 0') end