%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         6.gyakorlat         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Nemlin. din. rsz-ek alapjai %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%        2014.11.05/06        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%           Fraktálok         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure;
title('Cantor halmaz');
%pontok=linspace(0,1, 10); %[0,1] egyenest képezi le
pontok=rand %1 db random pontból indul
plot(pontok, 0.1*ones(1, length(pontok)), 'b.');
xlabel('iteráció: 1');
xlim([0,1]);
ylim([0,2]);

hold on;
for i=2:20
 waitforbuttonpress;  
pontok=[1/3*pontok, 1/3*pontok+2/3]; %az elõzõ egyeneseket leképezzük az 1. és utolsó harmadukra
plot(pontok, 0.1*i*ones(1, length(pontok)), 'b.');
xlabel(['iteráció: ' num2str(i)]);
end
hold off;