필터 지우기
필터 지우기

How to plot planes parallel to the coordinate axes given by

조회 수: 18 (최근 30일)
Atom
Atom 2022년 7월 10일
댓글: Voss 2022년 7월 10일
How to plot planes parallel to the coordinate axes given by
y = linspace(0,5) ;
x = linspace(0,5) ;
[Y,X] = meshgrid(y,x) ;
Z = 3 ;
surf(X,Y,Z)
hold on
x = linspace(0,5) ;
z = linspace(0,5) ;
[Z,X] = meshgrid(z,x) ;
Y = 2 ;
surf(X,Y,Z)
hold on
y = linspace(0,5) ;
z = linspace(0,5) ;
[Z,Y] = meshgrid(z,y) ;
X = 1 ;
surf(X,Y,Z)

채택된 답변

Voss
Voss 2022년 7월 10일
편집: Voss 2022년 7월 10일
y = linspace(0,5) ;
x = linspace(0,5) ;
[Y,X] = meshgrid(y,x) ;
% Z = 3 ;
Z = 3*ones(size(X));
surf(X,Y,Z)
hold on
x = linspace(0,5) ;
z = linspace(0,5) ;
[Z,X] = meshgrid(z,x) ;
% Y = 2 ;
Y = 2*ones(size(X));
surf(X,Y,Z)
hold on
y = linspace(0,5) ;
z = linspace(0,5) ;
[Z,Y] = meshgrid(z,y) ;
% X = 1 ;
X = ones(size(Y));
surf(X,Y,Z)
  댓글 수: 2
Atom
Atom 2022년 7월 10일
Thanks a lot. what is ones(size(X))
Voss
Voss 2022년 7월 10일
A matrix of ones the same size as X. This is done because X, Y, and Z need to be compatible sizes in surf (in this case I'm making X, Y, and Z all the same size).
References: ones, size

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by