function web % web.m % By Jeremie Korta % December 1, 2003 % Requires web_starter file to work (unless r is put in by hand). global n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % some interesting values of the parameter r %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %n = 2; r = 1; % superstable 2-cycle %n = 3; r = fzero(@web_starter,[1,2]); % superstable 3-cycle %n = 4; r = fzero(@web_starter,[1.1,1.4]); % superstable 4-cycle #1 n = 4; r = fzero(@web_starter,[1.9,2.0]); % superstable 4-cycle #2 %n = 5; r = fzero(@web_starter,[1.6,1.7]); % superstable 5-cycle #1 %n = 5; r = fzero(@web_starter,[1.8,1.9]); % superstable 5-cycle #2 %n = 5; r = fzero(@web_starter,[1.9,2.0]); % superstable 5-cycle #3 %n = 7; r = fzero(@web_starter,[1.5,1.6]); % superstable 7-cycle #1 %n = 7; r = fzero(@web_starter,[1.6,1.7]); % superstable 7-cycle #2 %n = 7; r = fzero(@web_starter,[1.8,1.85]); % superstable 7-cycle #3 %n = 7; r = fzero(@web_starter,[1.85,1.9]); % superstable 7-cycle #4 %n = 7; r = fzero(@web_starter,[1.9,1.95]); % superstable 7-cycle #5 %n = 7; r = fzero(@web_starter,[1.95,1.96]); % superstable 7-cycle #6 %n = 7; r = fzero(@web_starter,[1.97,1.98]); % superstable 7-cycle #7 x = [0 0]; v = [x]; figure(1) clf for i=1:10 this_x = v(size(v,1),1); next = r-this_x^2; v = [v',[this_x next]',[next next]']'; end x = linspace(-max(1,r),max(1,r),100); plot(x,r-x.^2,'r',x,x,'r') hold on plot(v(:,1),v(:,2)); grid on; axis tight s=['Web plot of logistic map with r = ',num2str(r),' and x_0 = ', ... num2str(v(1,1))]; title(s) uicontrol('Style','pushbutton','Units','normalized',... 'Position',[.75 .01 .15 .05],'String','CLOSE',... 'BackGroundColor',[.0 .0 .9],'ForeGroundColor','w',... 'Fontsize',12,'Callback','uiresume;'); uiwait; close; % web_starter.m % n handles the iteration number. n = 3 implies 3 nested functions. % minimizing the function (done in web.m) will give the r for superstable % n-cycle. function x = logistic_nest(r) global n x = 0; for k=1:n x = -x.^2+r; end