
plotting 3D surface grids
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
R shah
am 30 Jul. 2016
Kommentiert: Star Strider
am 30 Jul. 2016
what specification should i use in order to get this sort (colour) of surf (X, Y, Z) grid attached below?

0 Kommentare
Akzeptierte Antwort
Star Strider
am 30 Jul. 2016
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 Kommentare
Star Strider
am 30 Jul. 2016
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!