I am using the meshgrid function to try and make a grid for my surface plots. My x,y, and z arrays are length 102, 42, and 102 respectively. But when I run [X,Y,Z] = meshgrid(x,y,z) the output has the wrong dimensions. X, Y and Z are 42 x 102 x 102 not 102 x 42 x 102. Can someone help me understand what is going wrong with this?
I tried playing around with the order and if I have [X,Y,Z] = meshgrid(y,x,z) it gives the correct output size of 102 x 42 x 102. For now I can run the code using this alternative order but I would like to know why it is making the wrong size.