N=255; [j,i]=meshgrid(0:N,0:N); r=sqrt((i/N).^2+(j/N).^2); % r: is distance from left-top corner % ranges from 0 to sqrt(2) fi=1./(sqrt(2)+0.3-r)*pi*30; IM=round((cos(fi)+1)/2*255); figure(1);imshow(IM,[]);