I understand that you want to define a color scaling by assigning specific colors to Z values. Further, Z values are general but not min or max values. To do so, you can use 'colors' parameter and direct mapping scheme in "surf" function. For example, the following code snippet builds a color vector that assigns specific colors to the Z values.
[X,Y,Z] = peaks(30);
figure
cmap = [1 0 0; 1 1 0; 0 1 0];
colormap(cmap);
crange = 1;
colors = zeros(size(Z));
colors(Z <= -crange) = 1; % red (1)
colors(Z > -crange & Z < crange) = 2; % yellow (2)
colors(Z >= crange) = 3; % green (3)
surf(X,Y,Z, colors, 'CDataMapping','direct');
I assign the colors based on Z values using a range. In general, you can build your color vector manually or programmatically to assign colors that suit your needs.
Direct mapping uses the color data directly as indices into the colormap. For example, a value of 1 points to the first color in the colormap, a value of 2 points to the second color, and so on. If the color data is noninteger, MATLAB rounds it toward zero. Values greater than the number of colors in the colormap are set equal to the last color in the colormap (i.e., the number length(colormap)). Values less than one are set to one.
For more information on coloring surface plots, refer to the following documentation page:
https://www.mathworks.com/help/matlab/visualize/coloring-mesh-and-surface-plots.html