% rungederiv.m % routine to plot derivatives of Runge's example, f(x) = 1/(1+x^2) on [-5,5] figure(1), clf, set(gca,'fontsize',18) for j=0:25 syms x fj = vectorize(diff(1/(x^2+1),j)); % compute derivative (symbolic toolbox) x = linspace(-5,5,1000); fjx = eval(fj); % evaluate on a grid of points plot(x,fjx,'b-','linewidth',2); % plot derivative title(sprintf('Runge''s Example: f^{(%d)}(x)',j),'fontsize',14) input(' ') end