function e = ellipsem(a,b,c,delta)
% e = ellm(a,b,c,delta) 
%
% Generates a matrix with an ellipse with delta spacing between grid elements
%
% On input:
%          a: x width of ellipse
%          b: y width of ellipse
%          c: z height of ellipse
%      delta: spacing between elements
% On output:
%          e: matrix with ellipse centered in it
%
n = a/delta;
for i1 = 1:(2*n+1)
   for j1 = 1:(2*n+1)
      e(i1,j1) = 0.0;
   end
end
for i1 = -n:n
   for j1 = -n:n
   	   y = i1*delta;
	   x = j1*delta;
	   d = (x*x)/(a*a) + (y*y)/(b*b);
	   if d <= 1
	      indexi = i1+n+1;
	      indexj = j1+n+1;
	      e(indexi,indexj) = c*sqrt(1 - d);
	   end
    end
end
