% Chaos control
clear
itermax=200;
mu=4;k=0.7;x=zeros(1,itermax);
x(1)=0.6;
for n=1:1:itermax
    x(n+1)=mu*x(n)*(1-x(n));    
    if (n>5) & (x(n)<0.66) & (x(n)>0.6)      % kontroluj pro n>5 v int (0.6,0.66).
    x(n+1)=k*mu*x(n)*(1-x(n));      
end                                 
end
hold on
    plot(1:itermax,x(1:itermax))
    plot(1:itermax,x(1:itermax),'o')
fsize=15;
set(gca,'XTick',0:50:itermax,'FontSize',fsize)
set(gca,'YTick',[0,1],'FontSize',fsize)
xlabel('n','FontSize',fsize)
ylabel('\itx_n','FontSize',fsize)
hold off

% End of Program_6a.