Question: how does ndgrid work matlab?
Answer: = ndgrid(x1,x2,x3,...) transforms the domain specified by vectors x1 , x2 , x3... into arrays X1 , X2 , X3... that can be used for the evaluation of functions of multiple variables and multidimensional interpolation. ... = ndgrid(x) is the same as [X1,X2,...] = ndgrid(x,x,...) .