# How to plot a surface which is perpendicular to xy-plane

22 Ansichten (letzte 30 Tage)
Mary Chang am 24 Sep. 2014
Kommentiert: 汉森 戴 am 29 Nov. 2022
I am trying to plot the surface determined by the function x = y(y-2) in 3-dimension. It is a plane perpendicular to xy-plane, and the intersection of this plane and xy-plane is a parabola. In MATLAB, usually we use surf(X, Y, Z) to plot a surface in 3-dimension, where X and Y are vectors with m and n elements respectively, and Z is a m*n matrix which z=f(x,y). However, the surf() is not able to be used here cause z is not a function of x and y. Which command should I use to construct the plane? Thank you very much.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Mischa Kim am 24 Sep. 2014
Bearbeitet: Mischa Kim am 24 Sep. 2014
Mary, use
[Y,Z] = meshgrid(-5:5,-5:5);
X = Y.*(Y - 2);
surf(X,Y,Z)
in other words, simply use Y and Z as the independent variables, X = X(Y,Z).
##### 3 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
John Smith am 16 Feb. 2022
Thank you sir!

Thank you bro

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by