How to plot planes parallel to the coordinate axes given by

31 ビュー (過去 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 Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by