How to make a cross section of the 3D plot ?

조회 수: 38 (최근 30일)
Vahram Voskerchyan
Vahram Voskerchyan 2021년 5월 27일
댓글: elaheh ghanati 2023년 6월 12일
How can I make a cross section of this plot.
I am want to get something like this but only one line of it (outline).
  댓글 수: 1
Adam Danz
Adam Danz 2021년 5월 27일
Assuming your 3D plot was created by a vector of x coordinates, a vector of y coordinates, and a matrix of z coordinates, if you want a 2D slice along the XZ plane, you just need to choose a slice from your z-matrix (ie, a row or a column) and plot that vector against your x-vector.

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

채택된 답변

Star Strider
Star Strider 2021년 5월 27일
Choose the appropriate ‘X’ and ‘Z’ (or ‘Y’ and ‘Z’) values from the matrix to get a cross-section.
[X,Y,Z] = peaks(50);
figure
surf(X,Y,Z)
xlabel('X')
ylabel('Y')
figure
plot(X(24,:),Z(24,:))
grid
figure
plot(X(11,:),Z(11,:))
grid
.
  댓글 수: 1
elaheh ghanati
elaheh ghanati 2023년 6월 12일
isnt this the plot of Z vs Y. As the changing factor is y coordinate

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by