function [A,x,y]=GenerateProblem(n,m,de);
% GENERATEPROBLEM generates organized random set of base stations
%   [A,x,y]=GenerateProblem(n,m,de); generates n x m base station
%   locations on a rectangular unitary grid, each at a random location
%   in a square of side 2*de centered at the corresponding gridpoint,
%   and computes the corresponding link gain matrix using the fact
%   that the signal decays like 1/r^3.  The output is the link gain
%   matrix A and the coordinates of the base stations (x,y).

[X,Y]=meshgrid(1:n,1:m);
X=X+de*(rand(size(X))-1/2);
Y=Y+de*(rand(size(Y))-1/2);
x=X(:);
y=Y(:);
for i=1:n*m-1,
  for j=i+1:n*m,
    A(i,j)=1/(sqrt((x(i)-x(j))^2+(y(i)-y(j))^2)^3);
    A(j,i)=A(i,j);
  end;
end;
plot(x,y,'o','MarkerSize',12,'LineWidth',2)