MATLAB Answers

0

I am trying to plot a 3D figure defined by z>=0:

Asked by Sultan Al-Hammadi on 13 Oct 2018 at 14:02
Latest activity Edited by Sultan Al-Hammadi on 15 Oct 2018 at 11:37

I triY(I),Z(I),'.'); xlabel('X'); ylabel('Y'); zlabel('Z');

Please help me

  0 Comments

Sign in to comment.

1 Answer

Answer by Bruno Luong on 13 Oct 2018 at 14:32
Edited by Bruno Luong on 13 Oct 2018 at 15:34

x = linspace(-2,2,50); 
y = linspace(-2,2,50);
z = linspace(-0.1,2,50);
x = reshape(x,[],1,1);
y = reshape(y,1,[],1);
z = reshape(z,1,1,[]);
R2 = x.^2+y.^2+z.^2;
I = R2>=1 & R2<=4 & z>=0;
isosurface(x,y,z,I,0.5); % 0.5 is middle of 0 and 1
axis equal

  4 Comments

Show 1 older comment

Use the mouse turn the object and look from bottom

Accept the answer if it was useful and helpful

Sign in to comment.