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

38 vues (au cours des 30 derniers jours)
Vahram Voskerchyan
Vahram Voskerchyan le 27 Mai 2021
Commenté : elaheh ghanati le 12 Juin 2023
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 commentaire
Adam Danz
Adam Danz le 27 Mai 2021
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.

Connectez-vous pour commenter.

Réponse acceptée

Star Strider
Star Strider le 27 Mai 2021
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 commentaire
elaheh ghanati
elaheh ghanati le 12 Juin 2023
isnt this the plot of Z vs Y. As the changing factor is y coordinate

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by