function webFixPt %matlab code by Ed Greco 06/09/19 %HW Problem 26.1----- %A) generate f(x) = lambda - x^2 % and plot web graph of convergance to an attractive fixed point. % export figure as .eps manually lambda = .6; % less than 3/4 bifurcation value Xmax = lambda*(1.05); % axis a bit higer than max of f(x) Xall = (0:0.01:Xmax); % points to plot parabola (seems too many) x(1) = .6; num_iter = 30; %the number of times to iterate for i = 1:2:num_iter x(i+1) = lambda - x(i)^2; % next point x(i+2) = x(i+1); % next point on diagonal end figure plot(x(2:end-1),x(3:end),':') % web as dotted line xlabel('x_n') % labels - increase font ylabel('x_{n+1}') axis([0 Xmax 0 Xmax]) % remove most ticks axis square hold on % keep on plotting plot(x(2:end-1),x(3:end),'.','MarkerSize',10,'Color','k') %attempt putting dots plot(Xall,lambda - Xall.^2,'LineWidth',2,'Color','k') % parabola plot(Xall,Xall,'-.') %diagonal lamFix = roots([1 1 -lambda]); % 2 fixed point plot(max(lamFix),max(lamFix),'.','MarkerSize',20,'Color','k') %plot rightmost return end