I want to highlight the curve of intersection of the sphare and the plane x+y+z=0 by a thick blue curve. How to do that?
Mostra commenti meno recenti
I want to highlight the curve of intersection of the sphare and the plane
by a thick blue curve. How to do that? I have tried to hightight in the last few line of the code below but it does not work................... where is the mistake
%% Sphere parametrizing in spherical coordinates
R = 1 ;
theta = linspace(0,2*pi) ;
phi = linspace(0,pi/2) ;
[T,P] = meshgrid(theta,phi) ;
X1 = R*cos(T).*sin(P) ;
Y1 = R*sin(T).*sin(P) ;
Z1 = R*cos(P) ;
zlim([0,5])
surf(X1,Y1,Z1,'EdgeColor','r', 'FaceColor', 'none', 'FaceAlpha', .5) ;
% plane
hold on
x1 = -1:0.5:1; x2 = -1:0.5:1;
[X Y] = meshgrid(x1,x2);
Z=-X-Y;
%mesh(X1,Y1,Z1,'FaceAlpha',.5)
surf(X, Y, Z);
zlim([-1.5,1.5]);
xlabel('x')
ylabel('y')
zlabel('z')
%%%%%%%%%%%%% to highlight the curve of intersection of the sphare and the plane by a blue curve
hold on
R = 1 ;
T = 0:0.5:2*pi ;
X2 = R*cos(T) ;
Y2 = R*sin(T) ;
Z2 = -X2-Y2 ;
plot3(X2,Y2,Z2,'b', 'LineWidth',2) ;
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Sparse Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!