function planos(n,A,b,yi,u,xl,xu,fig)

[r,p] = size(A);
m = p - n - 2;
Ax = A(2:r,1:n);

if n < 2 || n > 3
  disp('only two- or tri-dimensional plots');
  return;
end

if size(yi,2) ~= m
  disp('wrong size for y');
  return;
end

str = ['y = [ ' sprintf('%d  ',yi) ']    u = ' sprintf('%f',u)];
bx = b(2:r) - A(2:r,n+1:p-1) * [yi u]';

xul = min(xu(1),20);
dx = (xul - xl(1)) / 20;
x = [xl(1):dx:xul];
yul = min(xu(2),20);
dy = (yul - xl(2)) / 20;
y = [xl(2):dy:yul];

figure(fig);
//colormap('default');
//map = colormap;
clf;
cor=[eye(3,3);1 1 0;1 0 1;0 1 1;1 1/2 0;0 1/2 0];
Ax
bx

if n > 2
  zul = min(xu(3),20);
  dz = (zul - xl(3)) / 20;
  z = [xl(3):dz:zul];
  
  cg = 0;
  for i = 1:r-1
     flag = 1;
     if Ax(i,3) == 0,
       if Ax(i,2) == 0,
         if Ax(i,1) ~= 0,
           [Y,Z] = meshgrid(y,z);  
           X = bx(i) / Ax(i,1) * ones(size(Y));
         else
           flag = 0;
         end
       else
         [X,Z] = meshgrid(x,z);
         Y = (bx(i) - Ax(i,1) .* X) ./ Ax(i,2);
       end 
     else
       [X,Y] = meshgrid(x,y);
       Z = (bx(i) - Ax(i,1) .* X - Ax(i,2) .* Y) ./ Ax(i,n); 
     end

     if flag,
       h=mesh(X,Y,Z);
       set(h,'edgecolor',cor(i,:));
       cg = cg + 1;
       if cg == 1
         axis([xl(1) xul xl(2) yul xl(3) zul]);
         xlabel('x_1'); ylabel('x_2'); zlabel('x_3');
         title(str);
//         shading interp;
//         hidden off;
         hold;
       end
     end
  end
else
  cg = 0;
  for i = 1:r-1
     flag = 1;
     if Ax(i,2) == 0,
       if Ax(i,1) ~= 0,
         Y = y;  
         X = bx(i) / Ax(i,1) * ones(size(Y));
       else
         flag = 0;
       end
     else
       X = x;
       Y = (bx(i) - Ax(i,1) .* x) ./ Ax(i,2);
     end 

     if flag,
       h=plot(X,Y);
       set(h,'Color',cor(i,:));
       cg = cg + 1;
       if cg == 1
         axis([xl(1) xul xl(2) yul]);
         xlabel('x_1'); ylabel('x_2');
         title(str);
         hold;
       end
     end
  end
       
end

pause;

endfunction
