function hermanj3(); nx = 600; ny = 800; ColorMset = zeros(nx,ny,3); xmin = -4.5; xmax = 4.5; ymin = -4; ymax = 8; maxiter = 400; wb = waitbar(0,'Please wait...'); for iy = 1:ny cy = ymin + iy*(ymax - ymin)/(ny - 1); for ix= 1:nx cx = xmin + ix*(xmax - xmin)/(nx - 1); [k myfl] = Mlevel(cy,cx,maxiter); if myfl==2 ColorMset(ix,iy,2) = abs(sin(2*k/10+pi/4)); %ColorMset(ix,iy,2) = abs(k); else if myfl==1 ColorMset(ix,iy,1) = abs(sin(2*k/10)); else %ColorMset(ix,iy,2) = abs(sin(2*k/10+pi/4)); ColorMset(ix,iy,3) = abs(cos(2*k/10)); end end end waitbar(iy/ny,wb) end close(wb); %ColorMset(:,:,2) = ColorMset(:,:,2)/max(max(ColorMset(:,:,2))); image(ColorMset); imwrite(ColorMset,'herman.jpg','jpg','Quality',100); save 'hermat' ColorMset function [potential myfl] = Mlevel(cx,cy,maxiter) z = complex(cx,cy); th=pi*(-1+sqrt(5)); d=exp(complex(0,th)); %a=complex(0,sqrt(3)); %a=sqrt(3); a=4; ang=0; iter = 0; while (iter < maxiter)&&(abs(z) > 0.001)&&(abs(z)<20) h=z; z=d*z*z*(z-a)/(1-a*z); hh=abs(z-h)*(z-h); if iter>maxiter-100 ang=ang+hh; end iter = iter+1; end if iter < maxiter potential = iter; if abs(z)>=20 myfl=0; else myfl=1; end else %potential = -(ang-floor(ang)); potential=abs(ang); myfl=2; end