%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         6.gyakorlat         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Nemlin. din. rsz-ek alapjai %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          2015.11.04.        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          Fraktálok          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Júlia halmaz

% Paraméterek:
c = 0.36237 + 1i*0.32; %egyik komplex szám
felbontas=1000;
x = linspace(-1.2, 1.2, felbontas);    %valós rész
y = linspace(-1.2, 1.2, felbontas);    %képzetes rész
maxiter=100;%600;%100;%150;%
M=zeros(length(x));

for k = 1:length(x)
    for l = 1:length(y)
        n = 0;
        z = x(k)+1i*y(l); %másik komplex szám
        while ((n < maxiter) && (abs(z)<2))
            z = z*z+c; %iteráció, z-k soarozata a végtelenbe tart-e vagy periodikusan váltakozik vagy káosz a komplex síkon
            n = n+1;
        end
        if (abs(z)<2) %2-nél nagyobb abs(z) esetén végtelenbe tart
            M(k,l)=1; %jeleölön amik jók lehetnek
        end
    end
end

figure;
%imagesc(M);
imagesc(M);
colormap(bone);
axis xy;
xlabel('Re');
ylabel('Im');
colorbar;