function dz=e_V(x,y,parms)

x0=parms(:,1);  y0=parms(:,2);
R1=parms(:,3);  R2=parms(:,4);
theta=parms(:,5); gamma=parms(:,6); w=parms(:,7); 
Q=0;dz=0;
for i=1:length(R1)
   R=[cos(theta(i)) sin(theta(i)); -sin(theta(i)) cos(theta(i))];
   S=[R1(i)^2 0 ; 0 R2(i)^2];
   G=R'*S^-1*R;
   G_h=0.5*gamma(i)*G;
   q=[x-x0(i);y-y0(i)];
%   Q = Q + 2*pi/gamma(i)/ sqrt( det(G) );
   g_i=w(i)*exp(-q'*G_h*q);
   dz=dz + g_i; 
end