% Fixpunktsiteration för g(z) = z^2 + c (Mandelbrotmängden)
% Anders Logg 2013-09-19

maxiter = 100

figure
clf
hold on

i = sqrt(-1)

for x = -2:0.02:2

    for y = -2:0.02:2

        c = x + i*y;
        z = 0;

        for k = 1:maxiter
              z = z*z + c;
              if abs(z) > 2
                 break
              end
        end

        if k == maxiter
           plot(x, y, '.')
        end

    end
end
