Obtain cross section from a plot

조회 수: 11 (최근 30일)
JoshuaOsi George
JoshuaOsi George 2021년 4월 8일
편집: DGM 2021년 4월 10일
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.
  댓글 수: 3
JoshuaOsi George
JoshuaOsi George 2021년 4월 8일
yh, it should. But I'm the cutting whole square surface. So the coordinates I have would be for the floor. Sorry I had a typo. The coordinates shouls be X= (-1, 1, -1, 1), Y = (1, 1, -1, -1) Z = (0,0,0,0). so cut at point (-1,1,0),(1,1,0),(-1,-1,0),(1,-1,0)
Supposing I want to cut the middle, it would be X= (-1, 1, -1, 1), Y = (1, 1, -1, -1) Z = (2,2,2,2).
coordinates (-1,1,2),(1,1,2),(-1,-1,2),(1,-1,2)
JoshuaOsi George
JoshuaOsi George 2021년 4월 8일
and then if I want to cut vertically ( middle), tne coordinates would be X= (0, 0,0, 0), Y = (1, 1, -1, -1) Z = (0,4,0,4).
coordinates (0,1,0),(0,1,4),(0,-1,0),(0,-1,4)

댓글을 달려면 로그인하십시오.

답변 (1개)

DGM
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.
  댓글 수: 2
JoshuaOsi George
JoshuaOsi George 2021년 4월 10일
Hello Thanks @DGM. Is supertoroid a matlab function?
DGM
DGM 2021년 4월 10일
편집: DGM 2021년 4월 10일
No, that's from this thing on the FEX. Sorry about that. This includes superellipsoid() and supertoroid().

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by