
plotting 3D surface grids
11 次查看(过去 30 天)
显示 更早的评论
what specification should i use in order to get this sort (colour) of surf (X, Y, Z) grid attached below?

0 个评论
采纳的回答
Star Strider
2016-7-30
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.
2 个评论
Star Strider
2016-7-30
For the axis scales to display correctly, use both mesh independent coordinates arguments in the mesh call:
mesh(X,T,Z)
That should do what you want.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!