%SLIKA narise 'konvergenco' Newtonove metode
%SLIKA(meje,k,tol,gostota_x,gostota_y,eps)
%meje=[xmin xmax;ymin ymax]
%k in tol sta parametra za newton2d
%gostota_x in gostota_y je "stevilo pikslov v smeri x in y. 
function slika(meje,k,tol,gostota_x,gostota_y,eps);
  clf
  x=linspace(meje(1,1),meje(1,2),gostota_x);
  y=linspace(meje(2,1),meje(2,2),gostota_y);
  y=fliplr(y);
  M=[eye(3);0 0 0];
  colormap(M);
  A=4*ones(gostota_y,gostota_x);
  Nicle=[-1 0;1/2 -sqrt(3)/2;1/2 sqrt(3)/2];
  for i=1:gostota_y
    for j=1:gostota_x
      Z=newton2d('F','JF',[x(j);y(i)],k,tol);
      if norm(Z-Nicle(1,:)')<eps
         A(i,j)=1;
      elseif norm(Z-Nicle(2,:)')<eps
         A(i,j)=2;
      elseif norm(Z-Nicle(3,:)')<eps
         A(i,j)=3;
      end
    end
  end
  image(A);
