function complexgraph2(i);
nx = 720;
ny = 576;
cmat=zeros(nx,ny,2);
ColorMset = zeros(ny,nx,3);
scal=0.38;%quad
%scal=3/10;%cubic
%scal=1/4; %logistic
xmin = -scal*4-0.5; %quad
xmax = scal*4-0.5;
ymin = -scal*3;
ymax = scal*3;
wb = waitbar(0,'Please wait...');
for j=0:i
for iy = 1:ny
  cy = ymin + iy*(ymax - ymin)/(ny - 1);
  for ix= 1:nx
    cx = xmin + ix*(xmax - xmin)/(nx - 1);
    %c = complex(cx,cy);
    if j==0 
        c=complex(cx,cy);
    else
        hold=c;
        c=complex(cmat(ix,iy,1),cmat(ix,iy,2));
    end
      s=30;
   %cubic
   % ColorMset(iy,ix,1) = abs(cos(s*abs(c+1/sqrt(3))));
   % ColorMset(iy,ix,2) = abs(cos(s*angle(c+1/sqrt(3))));
   % ColorMset(iy,ix,3) = abs(cos(s*sqrt(abs(c+1/sqrt(3)))));
   % c=c^3-c+complex(cx,cy)-2/3/sqrt(3);
   %logistic
    %ColorMset(iy,ix,1) = abs(cos(s*abs(c-1/2)));
    %ColorMset(iy,ix,2) = abs(cos(s*angle(c-1/2)));
    %ColorMset(iy,ix,3) = abs(cos(s*sqrt(abs(c-1/2))));
    %c=(complex(cx,cy))*4*c*(1-c);
     %quad
    ColorMset(iy,ix,1) = abs(cos(s*abs(c)));
    ColorMset(iy,ix,2) = abs(cos(s*angle(c)));
    ColorMset(iy,ix,3) = abs(cos(s*sqrt(abs(c))));
    c=c^2+complex(cx,cy);
    %c=complex(cx,cy)*cos(c);
    %c=complex(cx,cy)*sin(c)/c;
    %c=complex(cx,cy)*cos(sqrt(c));
    cmat(ix,iy,1)=real(c);
    cmat(ix,iy,2)=imag(c);  
  end
end
waitbar(j/i,wb)
image(ColorMset);
%imwrite(ColorMset,strcat(num2str(j+10),'.jpg'),'jpg','Quality',100);
end
close(wb);