function I=fuzzeye(n,m,sigma)
% fuzzeye  Fuzzy nonsquare unit matrix
%
%          I=fuzzeye(n,m)
%          I=fuzzeye([n m])
%          I=fuzzeye(n,m,sigma)
%          I=fuzzeye([n m],sigma)
%
% return n by m 'fuzzy' unit matrix
% spread factor sigma is roughly in elements
% default sigma is m/n or n/m (the larger)

if length(n)>1, 
	if nargin<2, 
		sigma=2*max([n(2)/n(1) n(1)/n(2)]); 
	else
		sigma=m;
	end
	m=n(2); 
	n=n(1);
else
	if nargin<3, sigma=max([m/n n/m]); end
end

sigma=sigma/max([n m]); 
[X,Y]=meshgrid(0:m-1,0:n-1);
X = X/(m-1);
Y = flipud(Y)/(n-1);
Z = ((X-Y).^2)/(sigma^2);
I = exp(-Z/2);
