Main Content

Die Übersetzung dieser Seite ist veraltet. Klicken Sie hier, um die neueste Version auf Englisch zu sehen.

Erstellen von 3D-Diagrammen

Dieses Beispiel veranschaulicht, wie Sie verschiedene 3D-Diagramme in MATLAB® erstellen.

Maschendiagramm

Mit der Funktion mesh wird ein Drahtmodell erstellt. Die Farbe dieses Drahtmodells ist proportional zur Höhe der Oberfläche.

z = peaks(25);

figure
mesh(z)

Figure contains an axes object. The axes object contains an object of type surface.

Oberflächendiagramm

Mit der Funktion surf erstellen Sie ein dreidimensionales Oberflächendiagramm.

surf(z)

Figure contains an axes object. The axes object contains an object of type surface.

Oberflächendiagramm (mit Schattierungen)

Mit der Funktion surfl erstellen Sie ein Oberflächendiagramm mit einer Beleuchtung gemäß Farbzuordnung. Wenn die Farbverläufe sanfter ausfallen sollen, wählen Sie eine Farbzuordnung mit linearer Variation der Intensität wie zum Beispiel pink.

surfl(z)
colormap(pink)    % change color map
shading interp    % interpolate colors across lines and faces

Figure contains an axes object. The axes object contains an object of type surface.

Konturdiagramm

Mit der Funktion contour erstellen Sie ein Diagramm mit Konturlinien konstanter Werte.

contour(z,16)
colormap default    % change color map

Figure contains an axes object. The axes object contains an object of type contour.

Quiver-Diagramme

Mit der Funktion quiver werden 2D-Vektoren als Pfeile dargestellt.

x = -2:.2:2; 
y = -1:.2:1;

[xx,yy] = meshgrid(x,y);
zz = xx.*exp(-xx.^2-yy.^2);
[px,py] = gradient(zz,.2,.2);

quiver(x,y,px,py)
xlim([-2.5 2.5])    % set limits of x axis

Figure contains an axes object. The axes object contains an object of type quiver.

Schichten in 3D-Volumen

Mit der Funktion slice werden Daten in Ebenen dargestellt, die schichtenweise volumetrische Daten unterteilen.

x = -2:.2:2;
y = -2:.25:2;
z = -2:.16:2;

[x,y,z] = meshgrid(x,y,z);
v = x.*exp(-x.^2-y.^2-z.^2);

xslice = [-1.2,.8,2];    % location of y-z planes
yslice = 2;              % location of x-z plane
zslice = [-2,0];         % location of x-y planes

slice(x,y,z,v,xslice,yslice,zslice)
xlabel('x')
ylabel('y')
zlabel('z')

Figure contains an axes object. The axes object with xlabel x, ylabel y contains 6 objects of type surface.