%This script solves and plots the logistic DE (Pr. 6.32).
%For Pr. 6.31 you have to change the iteration prescription

r=0.8;            %for logistic DE: set parameter
nmax=50;          %set number of iterations
p=0.5;            %set initial value
N=0:nmax;         %define time range
P=p;              %initialize solution array

for n=1:nmax      %compute iterates and write in solution array
    p=r*p*(1-p);  %the right hand side defines the itertaion prescription
    P=[P p];      %append iterates to solution array
end
plot(N,P,'k')