% Script: Ordofconv % two sequences illustrating linear and quadratic convergence % x=1:50; y1 = 2.^-(x-1); x2 = 1:10; y2 = 2.^(-2.^(x2-1)); figure(1) % open first figure semilogy(x,y1,'-',x2,y2,'--') % semilog plot for showing decay with n xlabel('n') legend('a_n: linear','b_n: quadratic',4) title('Decay of a_n and b_n with n') pause % % now illustrate rate of convergence figure(2) % open secone figure, keeps first loglog(y1(1:end-1),y1(2:end),'-',y2(1:end-1),y2(2:end),'--') xlabel('a_n') ylabel('a_{n+1}') legend('a_n: linear','b_n: quadratic',4) title('Rate of Convergence')