clc
clear
disp('Specify the number of iterations, e.g., 20 or 100.')
n_iter=input('The number of iterations n_iter = ');
disp('Specify the rho parameter, e,g, 0.7 or 1.4 or 2.8 or 3.6 or 3.9.')
rho=input('The rho parameter = ');
x=.1;
x_0=x
fx='rho*x*(1-x)';
t=linspace(0,n_iter,n_iter+1);
for i=1:n_iter
fxe(i)=eval(fx);
disp('----------------------------')
disp('Iteration number=')
disp(i)
x=fxe(i)
end
plot(t,[x_0 fxe(1:n_iter)])
axis([0 n_iter 0 1])
grid
xlabel('{\it k}','Fontsize',12)
ylabel('{\it x}({\it k})','Fontsize',12)
title('Solution of the logistic equation','Fontsize',12)
