MATLAB: Plotting 3D surface grids

MATLAB

what specification should i use in order to get this sort (colour) of surf (X, Y, Z) grid attached below?

Best Answer

This will reproduce it:
x = -40:5:40;
y = ones(1,16);
[X,Y] = meshgrid(x,y);
z = @(x,y) bsxfun(@plus, tanh(x * 0.1).*0.1, 1.5*Y);
Z = z(X,Y);
figure(1)
mesh(Z)
grid on
qx = xlim;
axis([1 17 1 16 1.4 max(zlim)])
view([25 60])
xt = 1:4:length(x);
xtl = regexp(sprintf('%.0f ',linspace(-40, 40, length(xt))), ' ', 'split');
set(gca, 'XTick',xt, 'XTickLabel',xtl(1:end-1))
yt = 1:5:length(y);
ytl = regexp(sprintf('%.0f ',linspace(0, 4, length(yt))), ' ', 'split');
set(gca, 'YTick',yt, 'YTickLabel',ytl(1:end-1))
zt = linspace(1.40, 1.60, 5);
ztl = regexp(sprintf('%.2f ',zt), ' ', 'split');
set(gca, 'ZTick',zt, 'ZTickLabel',ztl(1:end-1))
yielding this plot:
Reproducing it exactly without knowing the code that created the original means that this code is not as efficient as I would like it to be. Nevertheless, it works.
Related Question