% LOGMAPIT Iterations of the logistic map. clear r=4; x=.2; y=.2; Nk=100; X=[]; X=[X x]; Y=[]; Y=[Y y]; for k=1:Nk-1 x=logistic(x,r); X=[X;x]; y=logistic(y,r,'expanded'); Y=[Y;y]; end h=plot(0:Nk-1,X,'r',0:Nk-1,Y,'g'); xlabel('$k$','Interpreter','LaTeX') ylabel('$x_k$','Interpreter','LaTeX') legend({'$x''=rx(1-x)$';'$x''=rx-rxx$'},'Interpreter','LaTeX') K=(0:Nk-1)'; fid=fopen('data.txt','w'); fprintf(fid,' k r*x_k*(1-x_k) r*x_k-r*x_k*x_k\n'); fprintf(fid,'%3i %16.8f %16.8f\n',[K X Y]'); fclose(fid); data=[K X Y]; save data dat