# How to make a graph (or part of a graph) of space from a given equation or inequality

8 visualizaciones (últimos 30 días)

Editada: Torsten el 5 de Mayo de 2024

%绘制球面
Question: Draw the spatial three-dimensional figure intercepted by the sphere x^2+y^2+z^2<=16 and the cylindrical surface x^2+y^2=4x.
My code is:
%Draw the sphere
phi=0:0.1:pi;
theta=-pi:0.1:pi;
[phi,theta]=meshgrid(phi,theta);
x1=4.*sin(phi).*cos(theta);
y1=4.*sin(phi).*sin(theta);
z1=4.*cos(phi);
surf(x1,y1,z1)
hold on
%绘制柱面
s=-5:0.1:5;
t=-pi:0.1:pi;
[s,t]=meshgrid(s,t);
x2=2+2*cos(t);
y2=2*sin(t);
z2=s;
surf(x2,y2,z2)

The running result shows a graph formed by the intersection of two spatial surfaces.
My question: How to draw the solid in the first hexagram?
Try: I can't seem to achieve the ideal graph by changing the range of parameters.
##### 3 comentariosMostrar 1 comentario más antiguoOcultar 1 comentario más antiguo
Dyuman Joshi el 25 de Abr. de 2024
You could use alphaShape to get the 3D surface, then use inShape to get the common area and use plot on it.
Though, you will have to adjust the alpha radius.
"我的问题：如何绘出在第一卦限部分的立体"
"My question: How to draw the solid in the first hexagram?"
This is not clear to me. Could you please elaborate on this?

What I mean is to make a stereoscopic graph in the first octant part; That is, closed stereogram.

Iniciar sesión para comentar.

### Respuestas (1)

warnerchang el 26 de Abr. de 2024
Editada: Walter Roberson el 26 de Abr. de 2024
Anything like this:
phi=0:0.1:pi;
theta=0:0.1:pi/2;
[phi,theta]=meshgrid(phi,theta);
x1=4.*sin(phi).*cos(theta);
y1=4.*sin(phi).*sin(theta);
z1=4.*cos(phi);
surf(x1,y1,z1)
hold on
%绘制柱面
s=-5:0.1:5;
t=0:0.1:pi/2;
[s,t]=meshgrid(s,t);
x2=2+2*cos(t);
y2=2*sin(t);
z2=s;
surf(x2,y2,z2)
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Dyuman Joshi el 27 de Abr. de 2024
This does not give the graph of intersecting region.

Iniciar sesión para comentar.

### Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by