How to plot planes parallel to the coordinate axes given by

31 Ansichten (letzte 30 Tage)
Atom
Atom am 10 Jul. 2022
Kommentiert: Voss am 10 Jul. 2022
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)

Akzeptierte Antwort

Voss
Voss am 10 Jul. 2022
Bearbeitet: Voss am 10 Jul. 2022
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 Kommentare
Atom
Atom am 10 Jul. 2022
Thanks a lot. what is ones(size(X))
Voss
Voss am 10 Jul. 2022
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by