I get the following graph when I run
x1=0:0.01:1;
y1=0:0.01:1;
[X,Y]=meshgrid(x1,y1);
Z=0.8.*X+0.2.*Y;
surf(X,Y,Z);
And when I separately run this code
[X1,Y1]=meshgrid(a,b);
Z1=0.8.*X1+0.2.*Y1;
surf(X1,Y1,Z1,'EdgeColor','none');
I get the following
Here a,b are subsets of x1 and y1.
But what I want is I want to draw the second graph on top of the first surface graph. I used hold on, and used the code,
x1=0:0.01:1;
y1=0:0.01:1;
[X,Y]=meshgrid(x1,y1);
Z=0.8.*X+0.2.*Y;
surf(X,Y,Z);
hold on;
[X1,Y1]=meshgrid(a,b);
Z1=0.8.*X1+0.2.*Y1;
surf(X1,Y1,Z1,'EdgeColor','none');
this is what I get
Why can't I see the second graph on top of this?




z(x,y)is the same. What do you expect? If you want one of them on top (which is undefined a priori, since you have two infinitely flat surfaces at the exact same coordinates), change the correspondingzcomponents a bit, to ensure that it's above the other. - Andras Deak