How to draw D in 3D ?
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
D defined by x^2+y^2+z^2=4 and x+y+z=0
댓글 수: 0
답변 (2개)
  KSSV
      
      
 2016년 7월 9일
        x = linspace(0,1) ;
y = linspace(0,1) ;
[X,Y] = meshgrid(x,y) ;
D1 = (4-X.^2+Y.^2).^0.5 ;
figure
surf(X,Y,D1) ;
% x+y+z=0
D2 = -(X+Y) ;
figure
surf(X,Y,D2)
댓글 수: 0
  Carlos Guerrero García
      
 2022년 12월 2일
        
      편집: Carlos Guerrero García
      
 2022년 12월 2일
  
      There is a wrong sign in the KSVV isolation of z in the first equality, and so, the D1 definition must be
D1=(4-X^2-Y^2).^0.5
Also, I think that Tran Phuc question is about a joint representation of D1, D2, and the curve intersecction of D1 and D2, and so, I suggest the following code:
[x,y]=meshgrid(-2:0.1:2);
z1=-(x+y);
surf(x,y,z1); %The plane
hold on;
[r,t]=meshgrid(0:0.1:2,0:pi/60:2*pi); % Polar coordinates are nice for sphere representations
x=r.*cos(t);
y=r.*sin(t);
z2=sqrt(4-r.^2);
surf(x,y,z2); % The upper semisphere
surf(x,y,-z2); % The lower semisphere
theta=0:pi/60:2*pi;
ro=sqrt(2./(1+sin(theta).*cos(theta))); % After solving the system by hand
x=ro.*cos(theta); % The classical conversion
y=ro.*sin(theta); % The classical conversion
plot3(x,y,-(x+y),'or','MarkerSize',3);
axis equal
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



