In the following code, I can draw a graph of one two-dimensional Gaussian function:
x=linspace(-3,3,1000); y=x'; [X,Y]=meshgrid(x,y); z=exp(-(X.^2+Y.^2)/2); surf(x,y,z);shading interp
This is a plot created:

However, I would like to build a grid with the specified number x of these 2D Gaussians. Think of the following picture in the form of the above plot, which I would like to create (where, in particular, the grid is made of 5x5 2D Gaussian). Each Gaussian weight must be weighted by such a factor that if it is negative, then Gaussian indicates negative values โโof the z axis (black dots in the grid below), and if it is positive, as in the above image (white dots in the grid below).

Let me give you some mathematical details. The grid corresponds to a mixture of 2D Gaussians, summed up as in the following equation:

In which each Gaussian has its own mean and deviation.
Note that each Gaussian mixture must be placed in a specific (X, Y) coordinate so that they are equally distant from each other. for example, think of central Gaussian in (0,0), then others should be in (-1,1) (0,1) (1,1) (-1,0) (1,0) (-1, - 1) (0, -1) (1, -1) in the case of a grid with a dimension of 3x3.
Can you provide me (and explain to me) how I can make such a plot? Thank you in advance.