Here is an example
m = 20;
n = 500;
x = randn(500,1);
y = randn(500,1);
z = randn(500,1);
x1 = linspace(min(x),max(x),m);
y1 = linspace(min(y),max(y),m);
[X,Y] = meshgrid(x1,y1);
xy = hist3([x y],[m m]);
plot3(x,y,z,'.r')
surface(X,Y,xy*0-5,'cdata',xy)
axis vis3d
Best Answer