function drawMandelbrot(x,y,niters)
% drawMandelbrot(xvals,yvals)- draw the Mandelbrot set
% xvals, yvals: The x and y coordinates of the points
% to compute
if nargin < 3
 niters = 100;
end
[X,Y] = meshgrid(x,y); % Create the matrices of x and y
C = X + Y*1i;
s = zeros(size(C));
for k=1:length(s(:))
 s(k) = mandelbrotIterate(C(k), niters);
end
figure(gcf);
s = pcolor(x,y,s);
set(gca,’dataaspectratio’,[1,1,1]);
shading flat;