% ### EXlimits5.m ### [09.16.16 CB] % code to numerically demonstrate limit (t-->0+,0-) for the function % f(t)= [1/t - 1/(t^2+t)] % Questions % - What happens when xLim gets very small (e.g., +/- 10^-15)? You may need to zoom.... clear % -------------------- % User params. xLim= 0.1*[-1 1]; nPts= 100; % # of x-values to evaluate % -------------------- t= linspace(xLim(1),xLim(2),nPts); % linearly-spaced array of x-values % handful of relevant functions to evaluate f1=t; f2= 1./t; f3= 1./(t.^2+t); f4= (1./t - 1./(t.^2+t)); % main function to consider % plot (klunky in newest Matlab release; try also semilogy instead) figure(1); clf; h1= plot(t,f1,'.-','MarkerSize',15); hold on; grid on; h2= plot(t,f2,'o-','MarkerSize',3); h3= plot(t,f3,'x-','MarkerSize',3); h4= plot(t,f4,'s-','MarkerSize',3,'LineWidth',2); xlabel('t'); ylabel('some function of t'); title('Limit behavior leading into f(t)= [1/t - 1/(t^2+t)]') legend([h1 h2 h3 h4],'t','1/t','1/(t^2+t)','1/t - 1/(t^2+t)');