function [gx,gy] = makegrid(M)
%Usage: [gx,gy] = makegrid(M)

%gx,gy are M by M arrays, gx(i,j) = i/M, gy(i,j)=j/M, 0<=i,j<=M.

g = (-M:M)/M;

gx = zeros(2*M+1);
gy = zeros(2*M+1);

for j=1:2*M+1
    gx(j,:) = g;
end
gy=gx';