function xm = mode(X,N);
%function xm = mode(data,numbins);

[n,x] = hist(X,N);
i = find(n == max(n));
xm = mean(x(i));
return