Reputation: 1021
I've done the following code:
u=linspace(0,1,40);
v=linspace(0,1,40);
[u,v]=meshgrid(u,v);
x=u;
y=v.*sqrt(u);
z=x+y+1;
meshz(x,y,z)
xlabel('x-axis')
ylabel('y-axis')
Which gives the following image:
Now, I'd like to decrease the mesh walls down to the x-y-plane (at z=0
). I tried the following, which did not work:
u=linspace(0,1,40);
v=linspace(0,1,40);
[u,v]=meshgrid(u,v);
x=u;
y=v.*sqrt(u);
z=x+y+1;
meshz(x,y,z)
xlabel('x-axis')
ylabel('y-axis')
v=axis;
v(5)=0;
axis(v)
which yields the following picture:
I tried a couple of other things, like the last code: adding hold on
, calling meshz(x,y,z)
again, but they did not work. How I can extend the meshz
walls down to the x-y-plane?
Upvotes: 2
Views: 340
Reputation: 18504
One way to do this is to directly manipulate the 'ZData'
produced by meshz
via some handle graphics:
...
h = meshz(x,y,z); % Get handle
Z = get(h,'ZData'); % Get ZData
Z([1 end],:) = 0; % Set border to 0, or other desired value
Z(2:end-1,[1 end]) = 0;
set(h,'ZData',Z); % Set ZData
...
which produces
Upvotes: 3