%LPA.m - this MATLAB file solves the %discrete Larva-Pupa-Adult model of flour beetles. b=11.677; Ul=0.5129; Cea=0.011; Cel=0.0093; Cpa=0.0178; Ua=0.11; %input('input adult mortality Ua: ') L0=70; %input('input initial population L0: ') P0=30; A0=65; n=40; %input('end of time interval b: ') L=zeros(n+1,1); P=zeros(n+1,1); A=zeros(n+1,1); t=zeros(n+1,1); L(1)=L0; P(1)=P0; A(1)=A0; for i=1:n t(i)=i-1; L(i+1)=b*A(i)*exp(-Cea*A(i)-Cel*L(i)); P(i+1)=L(i)*(1-Ul); A(i+1)=P(i)*exp(-Cpa*A(i))+A(i)*(1-Ua); end t(n+1)=n; plot(t,L,'-o',t,P,'r:.',t,A,'-*') legend('Larvae','Pupae','Adults',0)