Question

I have the next script,

 R  = 0:0.1:1;
 z  = cos(-R);          
 zz  = sin(-R);        
 th = 0:pi/20:2*pi;
 X  = bsxfun(@times,R',cos(th));
 Y  = bsxfun(@times,R',sin(th));
 Z  = repmat(z',1,length(th));
 ZZ  = repmat(zz',1,length(th));
 surf(X,Y,Z)
 surf(X,Y,ZZ)
 box
 hold on
 surf(X*0 + 1,Y,Z) 
 surf(X*0 - 1,Y,ZZ)

I would like to have the plot result of the z and zz function, having different transparency.

The code is working using only the z function, but I can't make it to work z with zz; can't have surf plot z with zz. Any help is more than welcome.

Was it helpful?

Solution

I think you need to put the "hold on" right after the first surf plot. You can adjust the transparency with the "facealpha" parameter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top