The equation of the curve at the intersection of the two 3D surface, One is a cylinder.

3 visualizaciones (últimos 30 días)
There is a cylinder centered at (0,0) and extending in the direction of the z-axis. Then there is a 3D surface represented by some z=f(x,y). I want to express the equation of the intersection of these two by z=g(x,y). Please show me how to do this calculation.
I executed the following code, but I do not know what the calculated value indicates. I would appreciate it if you could tell me this as well.
----------------------------------
% シンボリック変数の定義
syms x y z
% 円筒と平面の方程式
r = 5; % 円筒の半径
cylinder_eq = x^2 + y^2 == r^2; % 円筒の方程式
plane_eq = z == x * y + 3; % 平面の方程式
z_range = z < 1000;
% 連立方程式を解く
sol = solve([cylinder_eq, plane_eq, z_range], [x, y, z]);
% 解の表示
disp(sol)
disp(sol.x)
disp(sol.y)
disp(sol.z)
----------------------------------
x: [7×1 sym]
y: [7×1 sym]
z: [7×1 sym]
(25/2 - 589^(1/2)/2)^(3/2)/3 - (25*(25/2 - 589^(1/2)/2)^(1/2))/3
(589^(1/2)/2 + 25/2)^(3/2)/3 - (25*(589^(1/2)/2 + 25/2)^(1/2))/3
0
0
0
(25*(25/2 - 589^(1/2)/2)^(1/2))/3 - (25/2 - 589^(1/2)/2)^(3/2)/3
(25*(589^(1/2)/2 + 25/2)^(1/2))/3 - (589^(1/2)/2 + 25/2)^(3/2)/3
(25/2 - 589^(1/2)/2)^(1/2)
(589^(1/2)/2 + 25/2)^(1/2)
0
-5
5
-(25/2 - 589^(1/2)/2)^(1/2)
-(589^(1/2)/2 + 25/2)^(1/2)
0
0
3
3
3
0
0
  2 comentarios
Sam Chak
Sam Chak el 20 de Jul. de 2024
Editada: Sam Chak el 20 de Jul. de 2024
Are you imagining this "intersection"?
[x, y] = meshgrid(-7:0.5:7);
r = 5; % 円筒の半径
% cylinder_eq = x^2 + y^2 == r^2; % 円筒の方程式
% plane_eq = z == x * y + 3; % 平面の方程式
z = x.*y + 3;
surf(x, y, z), hold on
num = 90;
[X,Y,Z] = cylinder(r, num);
h = 50;
Z = Z*h - h/2;
surf(X, Y, Z),
xlabel('x'), ylabel('y'), zlabel('z')
高木 範明
高木 範明 el 20 de Jul. de 2024
Yes, this image is correct. We want to know the equation of this intersecting curve.

Iniciar sesión para comentar.

Respuesta aceptada

John D'Errico
John D'Errico el 20 de Jul. de 2024
Editada: John D'Errico el 20 de Jul. de 2024
It is not always trivial to find that curve as some explicit function. Here, yes, you can do so easily enough.
syms x y z
r = 5; % radius of the cylinder
% A cylinder that runs parallel to the z axis, centered at the origin
cylinder_eq = x^2 + y^2 == r^2;
In fact though, a good way to represent that cylinder is to think about it in cylindrical coordinates, thus (r,theta,z), where the cylinder is now simply the surface represented as
r = 5
The second surface is a hyperbolic one, NOT a plane.
hyper_eq = z == x * y + 3;
But here is where the cylindrical coordinate change helps. If we replace
x = r*cos(theta)
y = r*sin(theta)
into that second surface relation, we will get:
syms theta
subs(hyper_eq,[x,y],[r*cos(theta),r*sin(theta)])
ans = 
Now we can plot that curve in 3-d as:
t = linspace(0,2*pi);
plot3(r*cos(t),r*sin(t),cos(t).*sin(t)*r^2 + 3,'-b')
box on
grid on
I suppose I could do more, and plot the two surfaces on top of this in a translucent form. But @Sam Chak already plotted them in a comment.
Anyway, what happened when you did as you used solve? You supplied it three equations, one of which was only an inequality? In fact, that inequaity is not even ever used. Solve actually found 7 distinct "solutions", even though there are infinitely many solutions. Solve was a bit confused as to what you wanted to see.
  3 comentarios
John D'Errico
John D'Errico el 20 de Jul. de 2024
Editada: John D'Errico el 20 de Jul. de 2024
Polar coordinates is such a natural thing to do there, because the cylinder is so perfectly represented in polar form. As well, we also know the solution locus lies on a perfect circle in the (x,y) plane, because any point must also lie on the cylinder. And that just steers it directly into a polar representation .
Could we have solved the problem using purely rectilinear coordinates? Well, surely the answer would be yes. No problem ever seems to have only one approach. Just that others may take more thought. :)
syms x y z
r = 5; % radius of the cylinder
% A cylinder that runs parallel to the z axis, centered at the origin
cylinder_eq = x^2 + y^2 == r^2;
hyper_eq = z == x * y + 3;
We want to solve for z, as a function of the other parameters. So one idea might be to just throw it into solve, and maybe it can think of something intelligent.
solve(cylinder_eq,hyper_eq,z)
ans = Empty sym: 0-by-1
And of course, that fails, miserably. Stupid computers. But we might try harder.
xsol = solve(cylinder_eq,x)
xsol = 
z_eq = subs(hyper_eq,x,xsol)
z_eq = 
It appears we have two branches. As long as the square roots yield a real result, then z will be real. That means we must have -5<=y<=5.
This solution seems not to care about x, But you can choose any value of y, and it will generate the value of z. Then if you know the value of y, you can also recover x, but there are two branches. Lets see what this result looks like. I hope it is the same. I'll need to use both branches to get the entire curve.
fplot3(sqrt(r.^2 - y.^2),y,y.*sqrt(5 - y).*sqrt(y+5)+3,[-5,5],'r')
hold on
fplot3(-sqrt(r.^2 - y.^2),y,3 - y.*sqrt(5 - y).*sqrt(y+5),[-5,5],'b')
Now I suppose there may be an easier way to solve this while still living in the cartesian system, but you should compare just how natural the solution was in polar form. And even if another approach may work out better than what I did, I'd not think it will be as simple as the polar one.
高木 範明
高木 範明 el 20 de Jul. de 2024
It's great!
I see that the equation for the intersecting curves can be calculated even in the rectilinear coordinate system. I also tried until I got "Empty sym: 0-by-1", but gave up there. I thought of solving it as an implicit function, so I didn't realize that I had to change it to an explicit function. Thank you so much for your teaching.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by