The trick to this is reformatting your data from vector format to a matrix format... I'd bet your X Y and Z data are vectors, meaning that each variable occupies a single column and rows are unique observations. You need to get that data into a matrix. The function 'meshgrid' will do this for you. You can then apply the function 'mesh' to the output of meshgrid to create the plot. You could also apply 'surf' or 'stem3' to the output of 'meshgrid' to create different looking plots.
Ordinarily Z is a function of X and Y. Meshgrid will 'fill-in' X between 1 and 3, and fill-in Y between 4 and 6. How should it fill-in the response variable, Z? This is where you typically have a function that you are plotting. So if your function is simply Z=X*Y, then you could do this:
x=[1,2,3];
y=[4,5,6];
z=[7,8,9];
[xi,yi]=meshgrid(x,y);
zi=xi.*yi;
surf(xi,yi,zi) %surface
figure
mesh(xi,yi,zi) %mesh
If you don't actually have a function that predicts Z using X and Y, but you want to plot the raw data, then do this: