Obtain cross section from a plot
11 次查看(过去 30 天)
显示 更早的评论
Hello. I would like to get a cross section of my plot at this point X= (-1, 1, -1, 1), Y = (1, 1, -1, 1) Z = (0,0,0,0). How can I do this? Any help would be appreciated. thanks.

回答(1 个)
DGM
2021-4-8
The answer is going to vary depending on how complicated you actually need to make it. If all you really need is going to be an intersection with a horizontal plane, then you can probably just use
contour(X,Y,Z,[h1,h2])
where h1,h2 are the z-level of the sample planes. If you only want one level, use [h1,h1].
[X,Y,Z] = supertoroid(0,[1 1 1 2],[4 4],100);
clf
subplot(1,3,1)
surf(X,Y,Z); shading flat; camlight; axis equal
subplot(1,3,2)
contour(X,Y,Z,[0 0.9]); axis equal
subplot(1,3,3)
contour(X,Z,Y,[0 1.2]); axis equal

If you want to make a section normal to either of the other two axes, then you can do that by swapping the X,Y,Z inputs to contour.
On the other hand, if you really need to make intersections between arbitrarily angled planes (or other surfaces), the problem gets a bit more complicated. In that case, you might want to take a look at the answer to this question and the associated blog post.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!