One way,
[x,y,z]=cylinder([0,7,7,0],100); z([1,2],:)=0; z([3,4],:)=0.1;
[theta,rho] = cart2pol(x,y);
keep=(theta<=pi & theta>=0) | rho==0;
z(~keep)=nan;
surf(x,y,z); axis equal
Another option:
[x,y,z]=cylinder([0,7,7,0],100); cidx = 1:ceil(size(x,2)*(pi/(2*pi))); % Scale Column Index By Fractions Of ‘2*pi’ z([1,2],:)=0; z([3,4],:)=0.1;
surf(x(:,cidx) ,y(:,cidx) ,z(:,cidx)); axis equal shading interp
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!