% charge densities on a line gives size of monic polynomial with roots as nodes % Barnett 10/9/08, after Trefethen n = 20; % # nodes - 1 x = -2:.01:2; y = -1.5:0.01:1.5; [xx yy] = meshgrid(x, y); zz = xx + 1i*yy; % zz is rect array of complex #s for d='uc' % loop over 'u' uniform then 'c' Chebychev density if d=='u' xj = linspace(-1,1,n+1); t = 'uniform'; else xj = cos(pi*(0:n)/n); t = 'Chebychev'; end a = poly(xj); % coeffs of monic poly with roots xj phi = log(polyval(a,zz))/(n+1); figure; contour(x,y,phi,[-1:.1:1]); hold on; plot(xj, 0, 'k.', 'markersize', 20); xlabel('Re z');ylabel('Im z');title(sprintf('phi(z) contours, %s density',t)) end