I have an Nx2 input matrix called X. I also have the output values Y which is a vector Nx1. I create some data to test as
You're using it wrong. Your z variable should be given by [L1(:),L2(:)]. Then what you should plot is:
surf(L1,L2,reshape(ymu,size(L1)));