Question: how to use ndgrid in matlab?
Answer: View MATLAB Command. Evaluate and plot the function. x 1 e - x 1 2 - x 2 2. ...  [X1,X2] = ndgrid(-2:. 2:2); Evaluate the function over the domain. Z = X1 . * exp(-X1. ^2 - X2. ...  mesh(X1,X2,Z) In R2016b and later releases, this task does not require the use of ndgrid .