% lect11_4: More 3D plots % Unit sphere [X, Y, Z] = sphere(20); surf(X, Y, Z); pause % Cylinder % Calculate the profile r of the cylinder t = linspace(0, pi, 20); r = 1+sin(t); [X, Y, Z] = cylinder(r); surf(X, Y, Z); axis square pause % 3D bar plot % Each column is one curve; rows hold the data Y = [1 6.5 7; 2 6 7; 3 5.5 7;... 4 5 7; 3 4 7; 2 3 7; 1 2 7]; Y bar3(Y) pause % 3D stem plot t = 0:0.2:10; x = t; y = sin(t); z = t.^1.5; stem3(x, y, z, 'fill'); grid on xlabel('x'); ylabel('y'); zlabel('z'); pause % 3D scatter plot t = 0:0.4:10; x = t; y = sin(t); z = t.^1.5; scatter3(x, y, z, 'filled'); grid on xlabel('x'); ylabel('y'); zlabel('z'); pause % 3D pie chart X = [5 9 14 20]; % explode is used to offset a slice explode = [0 0 1 0]; pie3(X, explode)