function coefm = parcoef(Kx,Ky)
% coefm = parcoef(Kx,Ky)
coefm = zeros(3,3);
kx = (Kx-1)/2;
ky = (Ky-1)/2;
coefm(1,3) = Kx*Ky;
c11 = 0; c12 = 0; c21 = 0; c22 = 0; c31 = 0;
for y = -ky:ky
  for x = -kx:kx
    x2 = x*x; y2 = y*y; x4 = x2*x2; y4 = y2*y2;
    c11 = c11 + x2;
    c12 = c12 + y2;
    c21 = c21 + x2*y2;
    c22 = c22 + y2*y2;
    c31 = c31 + x2*x2;
  end
end
coefm(1,1) = c11;
coefm(1,2) = c12;
coefm(2,1) = c21;
coefm(2,2) = c22;
coefm(2,3) = c12;
coefm(3,1) = c31;
coefm(3,2) = c21;
coefm(3,3) = c11;
