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

조회 수: 5 (최근 30일)
Mary Chang
Mary Chang 2014년 9월 24일
댓글: 汉森 戴 2022년 11월 29일
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.

답변 (1개)

Mischa Kim
Mischa Kim 2014년 9월 24일
편집: Mischa Kim 2014년 9월 24일
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
John Smith
John Smith 2022년 2월 16일
Thank you sir!
汉森 戴
汉森 戴 2022년 11월 29일
Thank you bro

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

카테고리

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